PicoCTF - RPS
Background
In C++, std::strstr() is a predefined function used for string handling. string.h is the header file required for string functions. This function takes two strings s1 and s2 as an argument and finds the first occurrence of the sub-string s2 in the string s1. The process of matching does not include the terminating null-characters(‘\0’), but function stops there. Syntax:
1
2
3
4
5char *strstr (const char *s1, const char *s2); Parameters: s1: This is the main string to be examined. s2: This is the sub-string to be searched in s1 string.Return Value: This function returns a pointer points to the first character of the found s2 in s1 otherwise a null pointer if s2 is not present in s1. If s2 points to an empty string, s1 is returned.
Source code
1 | |
Recon
這一題有reverse的感覺,主要是利用strstr()這個function拿到win++,在第100行的地方是利用strstr()搜索字串達到判斷勝利的功能,但是如果我們把三種結果結合在一起,則這一段結果就一定會試true
Exploit
Payload: paperscissorsrock
1 | |
Flag: picoCTF{50M3_3X7R3M3_1UCK_58F0F41B}