Challenges
Bypassing the check via integer overflow
PWN
Easy
Integer overflow
Solves: 5
Bypassing the check via integer overflow
Author: CyberSamSU
Points
20
Many vulnerable programs first accept the size requested by the user (len) in a larger type (for example, 16-bit), but then save it to an internal counter only as a 1-byte (8-bit, mod 256) value. The check is performed precisely on this truncated 8-bit value:
def sorov_qabul_qil(len_16bit):
len_8bit = len_16bit % 256 # kesish (truncation)!
if len_8bit < 14: # "xavfsiz" tekshiruv
nusxa_ol(len_16bit) # LEKIN asl (katta) qiymat bilan nusxalanadi!
else:
rad_et()
The buffer size is only 105 bytes. If len_16bit ≤ 105 — everything is safe. Your goal: send a value of len_16bit greater than 105 (meaning copying an amount actually larger than the buffer), but at the same time satisfy the condition len_16bit % 256 < 14 (bypass the check).
Find the smallest value of len_16bit that satisfies these conditions.
Send the answer in the format BAYROQ{PWN_OVERFLOWX_<son>}.
Theory: learn the topic
To submit a flag, log in.