https://buuoj.cn/challenges#[ASIS%202019]Unicorn%20shop

BUUCTF:[ASIS 2019]Unicorn shop_ico


BUUCTF:[ASIS 2019]Unicorn shop_ico_02


功能是一个购物商店,输入商品ID和价钱进行点击购买。源代码中提醒<meta charset="utf-8">很重要

html使用的是UTF-8编码

BUUCTF:[ASIS 2019]Unicorn shop_ico_03


id和price都为空点击购买,返回报错及原因

BUUCTF:[ASIS 2019]Unicorn shop_python_04


从中可以发现源代码是如何处理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
>>>

BUUCTF:[ASIS 2019]Unicorn shop_html_05


只能输入单个字符,猜测flag就是id = 4、price >= 1337 前端html使用的是utf-8,后端python处理使用的是unicode,编码不一致造成了转码问题利用这个网站https://www.compart.com/en/unicode 找一下大于单个字符数值化之后1337的

BUUCTF:[ASIS 2019]Unicorn shop_html_06


BUUCTF:[ASIS 2019]Unicorn shop_ico_07


找到这个字符的UTF-8 Encoding0xF0 0x90 0x84 0xA3

0x替换成%

id=4&price=%F0%90%84%A3

购买得到flag

BUUCTF:[ASIS 2019]Unicorn shop_python_08


阿里云国内75折 回扣 微信号:monov8
阿里云国际,腾讯云国际,低至75折。AWS 93折 免费开户实名账号 代冲值 优惠多多 微信号:monov8 飞机:@monov6