💾 Archived View for 0x80.org › gemlog › 2014-09-25-vortex-13.gmi captured on 2022-04-28 at 17:41:02. Gemini links have been rewritten to link to archived content
⬅️ Previous capture (2021-12-03)
-=-=-=-=-=-=-
Continuing the series of vortex here[1]. This is Vortex #13.
(Inconveniences)
How big is your shellcode? This level has a non-executable stack. You must login to vortex.labs.overthewire.org to complete this level.
okay so we grab the binary and take a look we see two functions.
int __cdecl main(int argc, const char **argv, const char **envp) { int i; // [sp+18h] [bp-8h]@3 int k; // [sp+18h] [bp-8h]@9 int j; // [sp+1Ch] [bp-4h]@4 int l; // [sp+1Ch] [bp-4h]@10 if ( argc ) exit(1); for ( i = 0; environ[i]; ++i ) { for ( j = 0; environ[i][j]; ++j ) environ[i][j] = 0; } for ( k = 0; argv[k]; ++k ) { for ( l = 0; argv[k][l]; ++l ) argv[k][l] = 0; } vuln(); return 0; } void vuln() { signed int i; // [sp+14h] [bp-14h]@3 char *s; // [sp+1Ch] [bp-Ch]@1 s = (char *)malloc(0x14u); if ( !fgets(s, 0x14, stdin) ) exit(1); for ( i = 0; i <= 19; ++i ) { if ( !strchr(allowed, s[i]) ) exit(1); } printf(s); free(s); }
so this is a format string and the string allowed is 0x14 bytes long. Also we are only allowed to use specific characters. The allowed characters are
'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789%.