minus-squarelobsters__kriive@crustaceanson.theshelf.topMtoLobsters - all tags@crustaceanson.theshelf.top•[c, security] Calling a function in C without naming itlinkfedilinkarrow-up1·23 days agoAwesome article! Did you try to run something like this? char *argv[] = {"/bin/sh", NULL}; char *envp[] = {NULL}; long ret; __asm__ volatile ( "syscall" : "=a"(ret) : "0"(59L), // SYS_execve "D"(argv[0]), "S"(argv), "d"(envp) : "rcx", "r11", "memory" ); As for how to mitigate this, the sandbox could try to use seccomp. Ideally it should allow only a subset of the syscalls (i.e. not execve) score 1 · canonical linkfedilink
Awesome article! Did you try to run something like this?
char *argv[] = {"/bin/sh", NULL}; char *envp[] = {NULL}; long ret; __asm__ volatile ( "syscall" : "=a"(ret) : "0"(59L), // SYS_execve "D"(argv[0]), "S"(argv), "d"(envp) : "rcx", "r11", "memory" );As for how to mitigate this, the sandbox could try to use seccomp. Ideally it should allow only a subset of the syscalls (i.e. not
execve)score 1 · canonical