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

边栏推荐
- Hyperledger Fabric 2. X custom smart contract
- Jupiter core error
- 海外仓知识科普
- Synchronized and lock escalation
- LVI: feature extraction and sorting of lidar subsystem
- PCL Library - error reporting solution: cmake and Anaconda conflicts during installation
- Pri3d: a representation learning method for 3D scene perception using inherent attributes of rgb-d data
- 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
- 老师能给我说一下固收+产品主要投资于哪些方面?
- Excuse me, is it cost-effective to insure sunshine Optimus Prime term life insurance No. 7? What are the advantages of this product?
猜你喜欢

Unity3d best practices: folder structure and source control
![[high concurrency] deeply analyze the callable interface](/img/24/33c3011752c8f04937ad68d85d4ece.jpg)
[high concurrency] deeply analyze the callable interface

隱私計算FATE-離線預測

SQL parsing practice of Pisa proxy

Computer screen splitting method

Tsinghua & Shangtang & Shanghai AI & CUHK proposed Siamese image modeling, which has both linear probing and intensive prediction performance

Pycharm安装与设置

Knowledge map model

基于Vue+Node+MySQL的美食菜谱食材网站设计与实现

Top ten Devops best practices worthy of attention in 2022
随机推荐
ThreadLocal之强、弱、软、虚引用
图书管理系统
I want to buy fixed income + products, but I don't know what its main investment is. Does anyone know?
Design skills of main function of Blue Bridge Cup single chip microcomputer
R language error
In the past, domestic mobile phones were arrogant in pricing and threatened that consumers would like to buy or not, but now they have plummeted by 2000 for sale
Why can't the start method be called repeatedly? But the run method can?
优雅的自定义 ThreadPoolExecutor 线程池
Pychart installation and setup
AbortController的使用
Je veux acheter des produits à revenu fixe + mais je ne sais pas quels sont ses principaux investissements.
Make a ThreadLocal (source code) that everyone can understand
巧用redis实现点赞功能,它不比mysql香吗?
PostgreSQL 15新版本特性解读(含直播问答、PPT资料汇总)
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
Elegant custom ThreadPoolExecutor thread pool
Notes learning summary
阅读别人的代码,是一种怎样的体验
Massive data! Second level analysis! Flink+doris build a real-time data warehouse scheme
How is the London Silver point difference calculated