From the course: Secure Coding in C++
Unlock this course with a free trial
Join today to access over 25,500 courses taught by industry experts.
Solution: Hacking the hardcoded password - C++ Tutorial
From the course: Secure Coding in C++
Solution: Hacking the hardcoded password
(upbeat music) - Let's take a look at three approaches you could have used to find the password hidden inside this binary. We'll start with the strings command. Here, we are listing all printable strings in the executable and using grep to find the one we saw in the terminal, which contains the text secret password. The dash C 10 flag means, show 10 lines of content around the match. Read closely and look for something that looks like a password. And just above the secret password prompt text, we see it. TakeLi-Li634%, that looks like our password. Great, so that's one approach. Another option is to dig into the executable using the GDB command line debugger. Let me run GDB on the executable. Now, I'll run the start command. We start the program and land right at main. Now I'll run the info files command. This tells us where each segment of the binary is loaded. We want our O data since that's where the string literals usually live, the read only data segment, and there it is. Our O…