We can see that isdigit only take the first character of our input. We can bypass this check using any string start with a number.
This function also use alloca, alloca will allocate a space on top of the current stack address.
Since the binary doesn't enable canary, if we can perform a buffer overflow on the code, we can control the rip and do a rop chain.
luckily, scanf give us an opportunity to do that. if we use %s in scanf, scanf will scan all the characters until some special character (such as \n, space) appear. This give us a chance to input a payload with any length and overwrite rest of the stack.
Finally payload is 1$s, 1 is used for bypass the check. and the final format string will be %1$ss. This give us the ability to overwrite whole stack.
Then, we can construct a ROP chain to leak libc address and perform ret2libc attack.
deflog_print(*msg): log.info(" ".join(map(str,msg))) lp = log_print defstart(): if args.LOCAL: r = process([exe.path]) if args.R2: input("Wait r2 attach") else: r = remote("65.21.255.31", 13370) return r