binaries

You found a custom Binary

"backup" example

  • From nodeHTB, mongodb

  • Custom app: /usr/local/bin/backup

  • Find a script that executes 'backup' and learn from it!

grep -Ri backup .               ..find references to 'backup'
find . | grep app.js            ..find our app
cat /var/www/myplace/app.js

const backup_key  = '45fac123...';
app.get('/api/admin/backup', function (req, res) {
    if (req.session.user && req.session.user.is_admin) {
      var proc = spawn('/usr/local/bin/backup', ['-q', backup_key, __dirname ]);
      var backup = '';

backup -q key /dir   ..we learned how to execute!

backup /root

Avoid '/root' Filter with Splatting

Work Local

  • Send file to yourself.. You have better analysis tools!

strace

Analyze Assembly: radare2

Analyze Assembly: binaryninja

  • Better graphics than radare2

  • But, doesnt show hex nicely

PrivEsc: Newline Character

PrivEsc: Newline Character printf

  • Newline character in printf function can also give you root!

Last updated

Was this helpful?