练习平台地址
题目描述
题目内容
打开发现说there is nothing,没有东西
F12检查也没有发现有效信息,于是看请求头
发现提示需要大的内部网络,应该是要进行XFF,BP抓包
常见的内网ip段
C类:192.168.0.0 - 192.168.255.255
B类:172.16.0.0 - 172.31.255.255
A类:10.0.0.0 - 10.255.255.255
当然这里是题目应该不会设置太复杂的,我们测试范围的开头和结尾即可
192.168.0.0
192.168.255.255
172.16.0.0
172.31.255.255
10.0.0.0
10.255.255.255
请求头
X-Custom-IP-Authorization
X-Forwarded-For
X-Forward-For
X-Remote-IP
X-Originating-IP
X-Remote-Addr
X-Client-IP
X-Real-IP
client-ip
BP爆破
访问m4nage.php
提示给他一个key
尝试传值
提示key不正确并返回了正确的key要满足的要求
key经过MD5加密之前是ichunqiu加上三位未知数,这三个可以使小写字母和数字中的任意一个,编写python脚本来进行暴力求解
md5(key)==="1b4167610ba3f2ac426a68488dbd89be",and the key is ichunqiu***,the * is in [a-z0-9]
脚本如下
python
import hashlib
import itertools
import string
# 目标MD5哈希值
target_hash = "1b4167610ba3f2ac426a68488dbd89be"
# 定义可能的字符集,这里包含小写字母和数字
charset = string.ascii_lowercase + string.digits
# 遍历可能的长度(这里假设长度范围是1到一定数值,比如8,你可以根据实际情况调整)
for length in range(1, 8):
# 生成所有可能的组合
for combination in itertools.product(charset, repeat=length):
key = "ichunqiu" + "".join(combination)
# 计算MD5哈希值
hash_object = hashlib.md5(key.encode())
hash_value = hash_object.hexdigest()
if hash_value == target_hash:
print(f"找到匹配的key: {key}")
break
else:
continue
break
网上的脚本
python
#!/bin/bash
import hashlib
def md5(data):
m = hashlib.md5()
m.update(data)
a = m.hexdigest()
return a
a = 'ichunqiu'
b = 'abcdefghijklmnopqrstuvwxyz1234567890'
for i in b:
for j in b:
for k in b:
if md5(a+i+j+k)=='1b4167610ba3f2ac426a68488dbd89be':
print a+i+j+k
key
ichunqiu105
访问xx00xxoo.php
source code is in the x0.txt.Can you guess the key
the authcode(flag) is 521c3EWKuGh5yBEURPzoLOuXWvj9ADEE2FBwpHyw8hVaEc2uGxQ/SdTSmIbgvQ1siJOB3JdJl8iWjAKwDTrLUec8mIoF3lM
源码如下
这应该就是一个解密函数,因为传值$operation = 'DECODE'
php
<?php
function authcode($string, $operation = 'DECODE', $key = '', $expiry = 0)
{
$ckey_length = 4;
$key = md5($key ? $key : UC_KEY);
$keya = md5(substr($key, 0, 16));
$keyb = md5(substr($key, 16, 16));
$keyc = $ckey_length ? ($operation == 'DECODE' ? substr($string, 0, $ckey_length) : substr(md5(microtime()), -$ckey_length)) : '';
$cryptkey = $keya . md5($keya . $keyc);
$key_length = strlen($cryptkey);
$string = $operation == 'DECODE' ? base64_decode(substr($string, $ckey_length)) : sprintf('%010d', $expiry ? $expiry + time() : 0) . substr(md5($string . $keyb), 0, 16) . $string;
$string_length = strlen($string);
$result = '';
$box = range(0, 255);
$rndkey = array();
for ($i = 0; $i <= 255; $i++) {
$rndkey[$i] = ord($cryptkey[$i % $key_length]);
}
for ($j = $i = 0; $i < 256; $i++) {
$j = ($j + $box[$i] + $rndkey[$i]) % 256;
$tmp = $box[$i];
$box[$i] = $box[$j];
$box[$j] = $tmp;
}
for ($a = $j = $i = 0; $i < $string_length; $i++) {
$a = ($a + 1) % 256;
$j = ($j + $box[$a]) % 256;
$tmp = $box[$a];
$box[$a] = $box[$j];
$box[$j] = $tmp;
$result .= chr(ord($string[$i]) ^ ($box[($box[$a] + $box[$j]) % 256]));
}
if ($operation == 'DECODE') {
if ((substr($result, 0, 10) == 0 || substr($result, 0, 10) - time() > 0) && substr($result, 10, 16) == substr(md5(substr($result, 26) . $keyb), 0, 16)) {
return substr($result, 26);
} else {
return '';
}
} else {
return $keyc . str_replace('=', '', base64_encode($result));
}
}
传入相应参数得到flag
php
echo authcode("521c3EWKuGh5yBEURPzoLOuXWvj9ADEE2FBwpHyw8hVaEc2uGxQ/SdTSmIbgvQ1siJOB3JdJl8iWjAKwDTrLUec8mIoF3lM",$operation = 'DECODE', $key = 'ichunqiu105', $expiry = 0);
flag
flag{3c1090ad-1bc3-47a6-a61d-2b5d0fda18da}
注意事项
在使用BP爆破内网ip时,要记得取消特殊字符编码