当前位置:网站首页>SQL 注入漏洞(十三)base64注入
SQL 注入漏洞(十三)base64注入
2022-06-22 06:16:00 【Aτθ】
一、base64編碼注入
base64 一般用於數據編碼進行傳輸,例如郵件,也用於圖片加密存儲在網頁中。數據編碼的好處是,防止數據丟失,也有不少網站使用
base64 進行數據傳輸,如搜索欄 或者 id 接收參數有可能使用 base64 處理傳遞的參數。在 php 中 base64_encode()函數對字符串
進行 base64 編碼也可以進行解碼。
編碼解碼流程:
1 ->base64 編碼->MQ==->base64 解密->1
base64 編碼注入,可以繞過 gpc 注入攔截,因為編碼過後的字符串不存在特殊字符。編碼過後的字符串,在程序中重新被解碼,再拼接成
SQL 攻擊語句,再執行,從而形式 SQL 注入。
二、代碼分析
從存在漏洞的代碼中,首先判斷是否有 POST 的 submit 參數過來,如果有使用$_COOKIE['uname']獲取 cookis 傳過來的賬號,再
拼接到 SQL 帶入查詢。
這段代碼的意思$cookee = base64_decode($cookee); 將$cookee 傳過來的參數進行解碼,所以$cookee 傳遞過來的數據必須先進
行編碼,否則解碼不了會導致出錯。

三、base64 編碼進行注入
1、測試注入點
首先觀察網站是否存在 base64 編碼的數據,例如傳遞的id值,搜索模塊。
如果存在類似==等,可以用 base64 解碼進行測試。
admin'and 1=1-- 編碼 YWRtaW4nYW5kIDE9MS0tIA== admin'and 1=2-- 編碼 YWRtaW4nYW5kIDE9Mi0tIA==
本次測試的頁面是 cookie ,所以需要 cookie 提交,而且有括號需要閉合。
原字符串 base64 編碼
admin') and 1=1-- YWRtaW4nKSBhbmQgMT0xLS0gIA== admin') and 1=2-- YWRtaW4nKSBhbmQgMT0yLS0gIA==





第一次提交頁面返回存在 admin,第二次提交沒有 admin,兩個頁面返回的結果不相同,所以存在 SQL 注入。
2、查詢敏感信息
本代碼存在 mysqli_error 函數,所以可以裏利用報錯注入再進一步獲取敏感信息。
admin') and (updatexml(1,concat(0x7e,(select user()),0x7e),1))--
進行 base64 編碼
YWRtaW4nKWFuZCAodXBkYXRleG1sKDEsY29uY2F0KDB4N2UsKHNlbGVjdCB1c2VyKCkpLDB4N2UpLDEpKS0tICA=
提交獲取敏感信息。


边栏推荐
- e.hash & oldCap == 0 详细解读
- Configuration files required for SSM integration and error reports caused by common configuration errors
- Markdown中插入类图(classDiagram)
- 单细胞论文记录(part7)--DL and alignment of spatially resolved single-cell transcriptomes with Tangram
- Modeling and Simulation of Radar Seeker Servo System
- 信息系统项目管理 - 范围管理(划重点)
- R语言观察日志(part24)--writexl包
- Generics in C #
- CMake 入门级别语法
- Unity app improves device availability
猜你喜欢

ReadWriteLock

Pyg tutorial (7): dissecting neighborhood aggregation

simulink中搭建专家pid控制

e.hash & oldCap == 0 详细解读

Expert PID control in Simulink

生信文献学习(part1)--PRECISE: a ... approach to transfer predictors of drug response from pre-clinical ...

SQLServer中的子查询
![[NAND file system] UBI introduction](/img/69/7213b8b39cebc1626eb6bb8cc10d16.png)
[NAND file system] UBI introduction

四大函数式接口(必需掌握)

Geoswath plus technology and data acquisition and processing
随机推荐
关于MNIST线性模型矩阵顺序问题
Little bear school bearpi HM micro officially integrated into openharmony trunk
汇顶科技GR551x系列开发板已支持OpenHarmony
Improve your game‘s performance
BinaryFormatter saving and loading game data for unity
Shengxin visualization (Part4) -- correlation diagram
Simple use of idea plug-in easy code
DataBricks从开源到商业化踩过的坑
虚职、架空、拖后腿,大厂开源办公室到底什么样?
【Rust笔记】01-基本类型
clickhouse对比两台机器数据
单细胞论文记录(part12)--Unsupervised Spatial Embedded Deep Representation of Spatial Transcriptomics
什么是JUC
舰载机自动着舰控制系统研究
Upload file prompt 413 request entity too large error
PyG教程(7):剖析邻域聚合
W800芯片平台进入OpenHarmony主干
Single cell thesis record (part13) -- spagcn: integrating gene expression, spatial location and history to
Single cell thesis records (part9) -- spatial charting of single cell transcriptomes in lectures
CMake 入门级别语法