https://buuoj.cn/challenges#[ASIS%202019]Unicorn%20shop
功能是一个购物商店,输入商品ID和价钱进行点击购买。源代码中提醒<meta charset="utf-8">
很重要
html使用的是UTF-8
编码
id和price都为空点击购买,返回报错及原因
从中可以发现源代码是如何处理price
的
使用的是unicodedata.numeric()
>>> import unicodedata
>>>
>>> unicodedata.numeric('1')
1.0
>>> unicodedata.numeric('11')
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
TypeError: numeric() argument 1 must be a unicode character, not str
>>>
>>> unicodedata.numeric('7')
7.0
>>> unicodedata.numeric('17')
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
TypeError: numeric() argument 1 must be a unicode character, not str
>>>
只能输入单个字符,猜测flag就是id = 4、price >= 1337
前端html使用的是utf-8
,后端python处理使用的是unicode
,编码不一致造成了转码问题利用这个网站https://www.compart.com/en/unicode 找一下大于单个字符数值化之后1337的
找到这个字符的UTF-8 Encoding
:0xF0 0x90 0x84 0xA3
将0x
替换成%
id=4&price=%F0%90%84%A3
购买得到flag