diff options
| author | Arslaan Pathan <[email protected]> | 2026-05-20 19:46:27 +1200 |
|---|---|---|
| committer | Arslaan Pathan <[email protected]> | 2026-05-20 19:46:27 +1200 |
| commit | cf00559b398eab50dc04a584ff22339258758364 (patch) | |
| tree | c22130b03dfb77f6ebbf807d9bda3cd43a0ba978 /vuln.c | |
| download | vuln-main.tar.xz vuln-main.zip | |
Diffstat (limited to 'vuln.c')
| -rw-r--r-- | vuln.c | 25 |
1 files changed, 25 insertions, 0 deletions
@@ -0,0 +1,25 @@ +#include <stdio.h> +#include <string.h> +#include <stdlib.h> + +void unused_function() { + printf("you did it! ROP achieved, we never call this function\n"); + printf("calling /bin/sh...\n"); + system("/bin/sh"); +} + +void vuln(char* input) { + char buffer[32]; + // copy input but dont check size, purposefully vulnerable so we can ROP our way through stuff + strcpy(buffer, input); + printf("Your argument was: %s\n", buffer); +} + +int main(int argc, char** argv) { + if (argc != 2) { + printf("Usage: %s <string>\n", argv[0]); + return 1; + } + vuln(argv[1]); + return 0; +} |
