06 10 2022-1
06 10 2022-1
Silton Santos
Oct 6, 2022
·
4 min read
·
Listen
For you who are beginning in cyber security, I think it is important to know the
basics SQL Injection vulnerability type and because we said: “After some single
quotes in requests parameters”. Thus we explain about this:
Provided there are no checks on the USER_INPUT, one could send the value of the
username admin’ — . This would bypass password check, because you will close the
username value and comment the rest of query. So, usually to test SQLi, pentesters
throw quotes around to try and trigger errors in the original query.
After installation, we found plenty of .jar files containing the application logic.
But it didn’t seem too time-friendy in our red team exercise to reverse engineer
and decompile them, so we went for a quicker path. To put it simply, we used the
logs of the application to help us writing the exploit.
With the log, it became possible to craft a good payload for the query, by
finishing the first query manually and to using the stacked query technique to
inject arbitrary content together. The next image shows a sample of the log:
We confirmed that the PostgreSQL version was vulnerable to the good old ‘COPY FROM
PROGRAM’ RCE trick, shown in the following SQL commands.
Finally, to test the RCE, we use the trick above to execute a ping command to
trigger a DNS lookup. The result is shows the command was executed remotely, as
shown in the next figures :
call of ping
<screenshot showing request DNS, result of ping>
Time line
Responsible disclosure to vendor — 16/07/2022
Reserved the CVE — 18/07/2022
Vendor’s response, saying he would check — 18/07/2022
Vendor’s response, informing public fixing —24/08/2022