githubEdit

Advanced SQLi

Interacting with PostgreSQL

psql -h <host> -U <username> <database>

Decompiling Java Archives

Fernflower

mkdir <OutputDirectory>
java -jar Fernflower.jar <Application>.jar <OutputDirectory>
cd <OutputDirectory>
jar -xf <Application>.jar

JD-GUI

jd-gui <Application>.jar

Regex Patterns for Finding SQLi Vulnerabilities

SELECT|UPDATE|DELETE|INSERT|CREATE|ALTER|DROP
(WHERE|VALUES).*?'
(WHERE|VALUES).*" +
.*sql.*"
jdbcTemplate

Live Debugging Java Applications

java -Xdebug -Xrunjdwp:transport=dt_socket,address=8000,server=y,suspend=y -jar <Application>.jar

Enabling PostgreSQL Logging

/etc/postgresql/13/main/postgresql.conf

  • Change #logging_collector = off to logging_collector = on

  • #log_statement = 'none' to log_statement = 'all'

  • Uncomment #log_directory = '...'

  • Uncomment #log_filename = '...'

Common Character Bypasses

  • Use /**/ instead of space

  • Use $$string$$ instead of 'string'

Error-Based SQL Injection

Reading and Writing Files

Reading with COPY

Reading with Large Objects

Writing with COPY

Writing with Large Objects

Command Execution

RCE with COPY

RCE with Extensions

Defending Against SQL Injection

Use parameterized queries!

Last updated