当前位置:网站首页>Network security - Cookie injection
Network security - Cookie injection
2022-07-24 13:42:00 【Beluga】
Comprehensive penetration test -Cookie Inject
First step , Open the network topology , Start the experimental virtual machine , View the virtual machines separately IP Address :
Kali Linux

Windows 7

The second step , Use Kali Linux visit sqli-lab The first 20 Close the page :
http://172.16.1.200( Drone aircraft IP Address )/sqli-labs/Less-20/

The third step , Right click Page - choice Inspect Element with Firebug

Step four , Switch to Cookies tab -Cookies-Create Cookie

Step five , Create a username Cookie, The name is uname, The value is admin, take Path It is amended as follows “/”

Step six , close window , And refresh the page

Step seven , After refreshing the page , Find out Cookie Has been shown

From the picture above we can see , We will Cookie Medium uname The user name is set to admin, Web page through SQL Statement to find out that the password of the user is admin. since uname Quoted and queried SQL, So by modifying Cookie in uname Value , We may be able to SQL Injection attack .
Step eight , Repeat the above steps again , Right click uname-edit, Modify the value of the user name

Step nine , Burst rows :
1) take uname The value of :
admin' order by 4--+

2) Refresh the page , Prompt that the fourth line does not exist

3) Set the “4” Change it to “3”, That is, sort in the third column , To judge whether the third column exists

4) Refresh the page , The page is normal , Prove that the database has three columns

Step 10 , Pop out the name of the current database :
1) modify uname Value :
-admin' union select 1,2,database()--+

2) Refresh the page , Get the current database name security

Step 11 , In the first 21 Turn off , Access address :
http://172.16.1.200/sqli-labs/Less-21

The twelfth step ,21 The level is also Cookie Inject . We just tested uname Still in force , But an error appears at the bottom of the page

The error occurred , The first thing we need to consider is coding . Because there was no problem in the last level test , So it's not a coding problem . So it's probably uname The value of is encrypted , The most likely one is one that can be restored base64 encryption .
Switch to Windows 7 Drone aircraft , View the website source code , verification base64 Encryption process
C:\AppServ\www\sqli-labs\Less-22\index.php

In the source code , adopt base64_encode Method sets the user name (username Field ) the base64 The encryption .
Thirteenth Step , Now uname To extract the value of , Put it base64 Encrypt and then write to Cookie among :
1) Right click uname-edit, Copy Value The value in

2) Open the terminal , Use the command to execute the current statement base64 encryption
echo -n "-admin' union select 1,2,database()--+" | base64

3) Paste the encrypted value back

4) Refresh the page , The page successfully parsed us base64 Encrypted value , But report an error

This means our “--+” Annotation symbols have lost their function .
5) Replace the injection statement , Recode :
echo -n "-admin') union select 1,2,database()#" | base64

6) write in Cookie

7) Refresh the page , Get the current database name

The fourteenth step , Access No. 22 checkpoint :
http://172.16.1.200/sqli-labs/Less-22

The fifteenth step , This level is still Cookie Inject , We are in the last level Cookie Still keep , First of all to see , Our current Cookie No result is returned

The sixteenth step , Switch to Windows 7 Drone aircraft , View the source code of this page , Find the cause :
C:\AppServ\www\sqli-labs\Less-22\index.php

22 Of the level SQL Statements are no longer contained in single quotes , It becomes double quotation marks .
The seventeenth step , Modify the injection statement just now , Use double quotation marks instead of single quotation marks , Then remove the brackets :
1) Generate a new uname value :
echo -n "-admin\" union select 1,2,database()#" | base64

2) Write to Cookie

3) Refresh the page , Inject success

End of experiment , Shut down the virtual machine .
边栏推荐
- Exploration of sustainable learning ability to support the application of ecological evolution of Pengcheng series open source large models
- 基于社会媒体数据增强的交通态势感知研究及进展
- Common OJ questions of stack and queue
- JQ remove an element style
- Wildcard (Pan domain name) SSL certificate
- Detailed explanation of odoo JS DoAction
- 网络安全——Web渗透测试
- 交换机链路聚合详解【华为eNSP】
- From cloud native to intelligent, in-depth interpretation of the industry's first "best practice map of live video technology"
- 网络安全——报错注入
猜你喜欢

Network security - file upload penetration test

Network security - Web information collection

简易订单管理系统小练习

Packaging class (mutual conversion between types)

第六章 总线

网络安全——Web渗透测试

群体知识图谱:分布式知识迁移与联邦式图谱推理

Group knowledge map: distributed knowledge transfer and federated map reasoning

Network security - file upload competitive conditions bypass

在EXCEL表格中如何进行快速换行
随机推荐
Packaging class (mutual conversion between types)
Realize a JS lottery?
如何生成预期数据?埃默里大学等最新《深度学习可控数据生成》综述,52页pdf涵盖346篇文献全面阐述可控生成技术体系
Detailed explanation of odoo JS DoAction
Chat room project
网络安全——文件上传内容检查绕过
Network security - file upload content check bypass
Icml2022 | branch reinforcement learning
汉字风格迁移篇---无监督排版传输
Selenium environment configuration and eight elements positioning
网络安全——Cookie注入
How to verify the domain name after applying for SSL digital certificate?
Recommended idling tools | comprehensive comparison of 10 spatial transcriptome deconvolution tools
Spelling words~
Hcip day 13
rhcsa第六次笔记
selenium环境配置和八大元素定位
Detailed tutorial of ettercap
Embedded cognitive network card PHY self negotiation
Introduction of embedded network interface scheme and summary of driver debugging methods