当前位置:网站首页>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注入漏洞

边栏推荐
- Library management system
- volatile与JMM
- Too many requests at once, and the database is in danger
- 基于SSM的Web网页聊天室系统
- [microservices sentinel] hotspot rules | authorization rules | cluster flow control | machine list
- ReentrantLock、ReentrantReadWriteLock、StampedLock
- 直播app运营模式有哪几种,我们该选择什么样的模式?
- 原子操作类
- Multithreading Basics (III)
- 易周金融 | Q1手机银行活跃用户规模6.5亿;理财子公司布局新兴领域
猜你喜欢

Volatile and JMM

How to select cross-border e-commerce multi merchant system

Today, Teng Xu came out with 37k during the interview. It's really a miracle. He showed me his skill

初识云原生安全:云时代的最佳保障

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

Leetcode 724. 寻找数组的中心下标(可以,一次过)
Talk about redis transactions

What are the operating modes of the live app? What mode should we choose?

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

Pychart installation and setup
随机推荐
Calcul de la confidentialité Fate - Prévisions hors ligne
Jupiter core error
CAS之比较并交换
ReentrantLock、ReentrantReadWriteLock、StampedLock
volatile与JMM
简析国内外电商的区别
Top ten Devops best practices worthy of attention in 2022
June 27, 2022 Daily: swin transformer, Vit authors and others said: a good basic model is the simple pursuit of CV researchers
关于 Spartacus 的 sitemap.xml 问题
R language error
Reflection learning summary
隱私計算FATE-離線預測
How to change a matrix into a triple in R language (i.e. three columns: row, col, value)
基于 Nebula Graph 构建百亿关系知识图谱实践
Different perspectives
Redis CacheClient
Knowledge map model
Notes learning summary
[microservices sentinel] hotspot rules | authorization rules | cluster flow control | machine list
Make a ThreadLocal (source code) that everyone can understand