当前位置:网站首页>sql注入原理
sql注入原理
2022-06-27 15:23:00 【冷巷(*_*)】
目录
1. sql注入的原因
语言可分为解析型语言和编译型语言。解析型是一种在运行时由一个运行时组件解析语言代码并执行其中包含的指令的语言。 而编译型是代码在生成时转换为机器指令,然后在运行时直接由使用改语言的计算机执行这些指令。
在解析型中,如果程序和用户进行交互。用户就可以构造特殊的输入来拼接到程序中执行,从而使得程序依据用户输入执行有可能存在恶意行为的代码。
比如 sql注入
2. 登录案例
登录sql语句: select *from admin where username ='用户输入的用户名'and password ='用户输入的密码'
用户输入的内容可由用户自行控制,例如可由输入'or 1=1'
sql语句: select * from admin where username =''or 1=1 --'and paswword ='用户输入的密码', 其中or 1=1 永远为真, --注释后面的内容不再执行, 因此sql语句执行会返回admin表中的所有内容。
比如这里

我们是不知道他的用户名还有密码的,我们随便输入一下,然后点登录会出错,提升错误。
那么,我们这样

注意, 1=1 -- -- 后面要加一个空格, 不然不会成功的!

可以看到,直接绕过了错误提示
3.cms sql注入
cms逻辑: index.php首页展示内容,具有文章列表(连接具有文章id)、articles.php文章详情页,URL中article.php?id=文章id读取id文章。
sql注入验证:
1. 单引号 '
2. and 1=1
3. and 1=2
如果页面中mysql报错,证明该页面存在sql注入漏洞

边栏推荐
- [interview questions] common interview questions (I)
- 我想买固收+产品,但是不了解它主要投资哪些方面,有人知道吗?
- 老师能给我说一下固收+产品主要投资于哪些方面?
- PostgreSQL 15新版本特性解读(含直播问答、PPT资料汇总)
- 基于SSM的Web网页聊天室系统
- Vscode uses yapf auto format to set the maximum number of characters per line
- 16 -- 删除无效的括号
- [PHP code injection] common injectable functions of PHP language and utilization examples of PHP code injection vulnerabilities
- I want to buy fixed income + products, but I don't know what its main investment is. Does anyone know?
- Interpretation of new version features of PostgreSQL 15 (including live Q & A and PPT data summary)
猜你喜欢

巧用redis实现点赞功能,它不比mysql香吗?

Getting to know cloud native security for the first time: the best guarantee in the cloud Era

CAS comparison and exchange

Pychart installation and setup

基于WEB平台的阅读APP设计与实现

Hyperledger Fabric 2. X custom smart contract

Design and implementation of food recipe and ingredients website based on vue+node+mysql

海量数据!秒级分析!Flink+Doris构建实时数仓方案

Knowledge map model
![[PHP code injection] common injectable functions of PHP language and utilization examples of PHP code injection vulnerabilities](/img/19/9827a5e8becfc9d5bf2f51bddf803e.png)
[PHP code injection] common injectable functions of PHP language and utilization examples of PHP code injection vulnerabilities
随机推荐
图书管理系统
ThreadLocal之强、弱、软、虚引用
避孕套巨头过去两年销量下降40% ,下降原因是什么?
[advanced MySQL] MTS master-slave synchronization principle and Practice Guide (7)
Leetcode 724. Find the central subscript of the array (yes, once)
数学建模经验分享:国赛美赛对比/选题参考/常用技巧
R language objects are stored in JSON
my. INI file configuration
ReentrantLock、ReentrantReadWriteLock、StampedLock
Julia1.1 installation instructions
Resolve activity startup - lifecycle Perspective
PCL Library - error reporting solution: cmake and Anaconda conflicts during installation
Volatile and JMM
Different perspectives
Fundamentals of software engineering (I)
What kind of experience is it to read other people's code
老师能给我说一下固收+产品主要投资于哪些方面?
我想買固收+產品,但是不了解它主要投資哪些方面,有人知道嗎?
固收+产品有什么特点?
Great God developed the new H5 version of arXiv, saying goodbye to formula typography errors in one step, and the mobile phone can easily read literature