Okay, after seeing this video, I think it was straightforward. When I was trying, I got to the point that I had to give some input greater than that mentioned (2*BUF_SIZE). I overlooked the %114d in one of the choices. I wrote Breakf@st_Burger 5 times in the input without spaces. I did get the message "There is no such burger yet", but I also got the flag. Is it because of some overflow?
I didnt really understand the working im kinda like a noob in this but could you explain how it works ?like my only doubt is why it segfaults for Cla%sic_Che%s%steak and not for any other combination of %s
So i tried this ctf just now and I got the flag by inputting aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa, was messing around after not paying attention to the code.....idk how and why it gave me the flag. Any possible explanation?
@@eduardorocadas9968 The call to signal(SIGSEGV,sigsegv_handler) makes it call the function sigsegv_handler (which prints the flag) whenever it crashes.
Sorry, but i don't know why printf(choice1) doesn't have format string error?
Because you aren't allowed to put in an arbitrary string, but only one on the menu.
Okay, after seeing this video, I think it was straightforward.
When I was trying, I got to the point that I had to give some input greater than that mentioned (2*BUF_SIZE). I overlooked the %114d in one of the choices. I wrote Breakf@st_Burger 5 times in the input without spaces. I did get the message "There is no such burger yet", but I also got the flag. Is it because of some overflow?
This problem prints the flag if you make it crash for any reason.
I didnt really understand the working im kinda like a noob in this but could you explain how it works ?like my only doubt is why it segfaults for Cla%sic_Che%s%steak and not for any other combination of %s
You might want to read more about format string specifiers, e.g. cplusplus.com/reference/cstdio/printf/.
So i tried this ctf just now and I got the flag by inputting aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa, was messing around after not paying attention to the code.....idk how and why it gave me the flag. Any possible explanation?
And nvm just read the comments, apparently as long as it crashes it gives u the flag. How do we know that tho? any line I code that indicates that?
@@eduardorocadas9968 The call to signal(SIGSEGV,sigsegv_handler) makes it call the function sigsegv_handler (which prints the flag) whenever it crashes.
@@carlislemc thank you so much, i was so confused on why my solution worked