wargame游戏记录 level 12 -level 22
level 12
1 | 题目信息: |
1 | bandit12 :/tmp/wyb$ ls |

- zcat用法学习
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
31zcat命令用于不真正解压缩文件,就能显示压缩包中文件的内容的场合。
语法:
zcat(选项) 压缩文件名
-S:指定gzip格式的压缩包的后缀。当后缀不是标准压缩包后缀时使用此选项;
-c:将文件内容写到标注输出;
-d:执行解压缩操作;
-l:显示压缩包中文件的列表;
-L:显示软件许可信息;
-q:禁用警告信息;
-r:在目录上执行递归操作;
-t:测试压缩文件的完整性;
-V:显示指令的版本信息;
-l:更快的压缩速度;
-9:更高的压缩比。
例如,现在不想使用gzip命令将file.gz文件解压,但是想查看其中的内容,可以执行命令:
zcat file.gz
level 13
1 | 题目信息: |
1 | bandit14 :~$ ls |
#ssh指定私钥登陆
cat /etc/bandit_pass/bandit14
level 14
1 | 题目信息: |
1 | bandit1430000 :~$ telnet localhost |

level 15
1 | 题目信息: |
1 | bandit1530001 -ign_eof :~$ openssl s_client -connect localhost: |
根据提示的信息页面,了解了openssl加密发送的方式
openssl s_client -connect localhost:30001 -ign_eof
level 16
1 | 题目信息: |
使用nmap扫描开放的端口
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
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104bandit1631000-32000 :~$ nc -z -v localhost
localhost [127.0.0.1] 31790 (?) open
localhost [127.0.0.1] 31518 (?) open
bandit1631790 :~$ openssl s_client -connect localhost:
CONNECTED(00000003)
depth=0 CN = localhost
verify error:num=18:self signed certificate
verify return:1
depth=0 CN = localhost
verify return:1
---
Certificate chain
0 s:/CN=localhost
i:/CN=localhost
---
Server certificate
-----BEGIN CERTIFICATE-----
MIICBjCCAW+gAwIBAgIEIRCKRDANBgkqhkiG9w0BAQUFADAUMRIwEAYDVQQDDAls
b2NhbGhvc3QwHhcNMTkwODAzMTU1MTQ5WhcNMjAwODAyMTU1MTQ5WjAUMRIwEAYD
VQQDDAlsb2NhbGhvc3QwgZ8wDQYJKoZIhvcNAQEBBQADgY0AMIGJAoGBALjLe4CV
y7o3TByY368V/nUFggs4EXLB6OPxbM7n9XR2fP5gBBFXeqT3jaupydtSYhWXTrgP
PqwB2Bk5v+v7twT6KZCM5ks54NgGqH8l48zzvqBFwvllQfpARfq0GTLixbrxuSmp
w9F8efzpOfxnoMdG9zvGBSm8M+UdAiQuprVpAgMBAAGjZTBjMBQGA1UdEQQNMAuC
CWxvY2FsaG9zdDBLBglghkgBhvhCAQ0EPhY8QXV0b21hdGljYWxseSBnZW5lcmF0
ZWQgYnkgTmNhdC4gU2VlIGh0dHBzOi8vbm1hcC5vcmcvbmNhdC8uMA0GCSqGSIb3
DQEBBQUAA4GBAHQ18wczrve2XIGz+hzhqZJ402L+pa5nl5ci76tTPtK0nAh4v+Ey
UlM+XvuL5l/opTiI6/+cObNUGOEpv8kVfwdAYiTr5RlXe9mBRErQl4r3PnhZylJM
cVD7/BsFM3uACmHVI5KRs2JSmnB4+sfZifHPxaMsLJvF6dUuHr+YC7E0
-----END CERTIFICATE-----
subject=/CN=localhost
issuer=/CN=localhost
---
No client certificate CA names sent
Peer signing digest: SHA512
Server Temp Key: X25519, 253 bits
---
SSL handshake has read 1019 bytes and written 269 bytes
Verification error: self signed certificate
---
New, TLSv1.2, Cipher is ECDHE-RSA-AES256-GCM-SHA384
Server public key is 1024 bit
Secure Renegotiation IS supported
Compression: NONE
Expansion: NONE
No ALPN negotiated
SSL-Session:
Protocol : TLSv1.2
Cipher : ECDHE-RSA-AES256-GCM-SHA384
Session-ID: 707A6D5A01E12ADB9A3F6B493C06B469CEFECA2B1D438DC242F109F724ACE07D
Session-ID-ctx:
Master-Key: C2E40DF41748B855B4DD3D6EE1056452436294DD9A6182754487979AA1FD15F91FDC5D9F782203536D24A31EF153B26F
PSK identity: None
PSK identity hint: None
SRP username: None
TLS session ticket lifetime hint: 7200 (seconds)
TLS session ticket:
0000 - 5c fe f6 48 80 2f 25 d8-f9 76 de 4d a7 c5 95 a7 \..H./%..v.M....
0010 - 04 42 9a e0 fa 8c 59 42-0c 07 60 eb 0f 2b a1 62 .B....YB..`..+.b
0020 - f7 64 3c 9b ea fc 86 d6-0b f6 d2 4c b7 51 91 1c .d<........L.Q..
0030 - 9c c1 09 b2 ad 4a be 68-f9 2e 61 e5 77 75 d5 b9 .....J.h..a.wu..
0040 - 43 b3 30 40 c8 0d d0 72-95 db 68 79 f0 14 a4 46 C.0@...r..hy...F
0050 - cf cc 1d 10 d2 81 ec f2-0f 95 2c 65 72 e2 ee 7a ..........,er..z
0060 - ba 01 44 85 33 d2 01 29-b9 a4 14 d4 ac 86 1b f7 ..D.3..)........
0070 - f2 8d a6 ff 6f 4b 83 b7-95 b3 97 39 40 d9 81 8c ....oK.....9@...
0080 - 07 60 50 2e 6d ac b1 4c-1c 4f 06 df 00 c0 90 d9 .`P.m..L.O......
0090 - f4 70 96 d1 3e 93 5a 3c-65 6e f0 a5 b3 24 ae 11 .p..>.Z<en...$..
Start Time: 1565698923
Timeout : 7200 (sec)
Verify return code: 18 (self signed certificate)
Extended master secret: yes
---
cluFn7wTiGryunymYOu4RcffSxQluehd
Correct!
-----BEGIN RSA PRIVATE KEY-----
MIIEogIBAAKCAQEAvmOkuifmMg6HL2YPIOjon6iWfbp7c3jx34YkYWqUH57SUdyJ
imZzeyGC0gtZPGujUSxiJSWI/oTqexh+cAMTSMlOJf7+BrJObArnxd9Y7YT2bRPQ
Ja6Lzb558YW3FZl87ORiO+rW4LCDCNd2lUvLE/GL2GWyuKN0K5iCd5TbtJzEkQTu
DSt2mcNn4rhAL+JFr56o4T6z8WWAW18BR6yGrMq7Q/kALH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HxbdLq/ZJQ7YfzOKU4ZxEnabvXnvWkU
YOdjHdSOoKvDQNWu6ucyLRAWFuISeXw9a/9p7ftpxm0TSgyvmfLF2MIAEwyzRqaM
77pBAoGAMmjmIJdjp+Ez8duyn3ieo36yrttF5NSsJLAbxFpdlc1gvtGCWW+9Cq0b
dxviW8+TFVEBl1O4f7HVm6EpTscdDxU+bCXWkfjuRb7Dy9GOtt9JPsX8MBTakzh3
vBgsyi/sN3RqRBcGU40fOoZyfAMT8s1m/uYv52O6IgeuZ/ujbjY=
-----END RSA PRIVATE KEY-----
closed
bandit16 :~$保存返回的密钥到文件,但只能在/tmp/目录下才有写入权限,用于登陆下一题
1 | bandit17 :/home$ cd .. |


level 17
1 | 题目信息: |
1 | passwords.new passwords.old |

1 | key: kfBf3eYk5BPBRzwjqutbbfE887SVc5Yd |
level 18
1 | 题目信息: |
- 刚连接就断开了,所以需要将需要执行的命令添加在连接命令后面
1 | ➜ ~ ssh bandit18"ls" .labs.overthewire.org -p2220 |

level 19
1 | 题目信息: |
连接后发现有个可执行文件,题目提示了下题密码位置,于是尝试看看能不能命令执行,一试果然可以!
中途有点傻逼,本身就是19题,我还查看了19题密码,没权限,才想起来,是需要查看20题密码,23333333!
1 | bandit19 :~$ ls |

level 20
1 | 题目信息: |
- 使用screen 开启一个后台发送上一题密码,并监听
1
2bandit20"GbKksEFF4yrVs6il55v6gwY5aVje5f0j" | nc -lp 12333 :~$ echo
bandit20 :~$

- 使用ctrl+A+D 将screen进入后台,此时执行程序到刚才坚挺的端口,
./suconnect 12333
,进行密码比较,相同基于输出密码1
2
3
4bandit2012333 :~$ ./suconnect
Read: GbKksEFF4yrVs6il55v6gwY5aVje5f0j
Password matches, sending next password
bandit20 :~$

- 得到下一题密码
1
2bandit20"GbKksEFF4yrVs6il55v6gwY5aVje5f0j" | nc -lp 12333 :~$ echo
gE269g2h3mw3pwgrj0Ha9Uoqen1c9DGr

level 21
1 | 题目信息: |
- cron定时任务,找到定时文件,找到写入的文件便找到密码
1
2
3
4
5
6
7
8
9
10
11
12bandit21 :/etc/cron.d$ ls
cronjob_bandit22 cronjob_bandit23 cronjob_bandit24
bandit21 :/etc/cron.d$ cat cronjob_bandit22
null bandit22 /usr/bin/cronjob_bandit22.sh &> /dev/
* * * * * bandit22 /usr/bin/cronjob_bandit22.sh &> /dev/null
bandit21 :/etc/cron.d$ cat /usr/bin/cronjob_bandit22.sh
#!/bin/bash
chmod 644 /tmp/t7O6lds9S0RqQh9aMcz6ShpAoZKF7fgv
cat /etc/bandit_pass/bandit22 > /tmp/t7O6lds9S0RqQh9aMcz6ShpAoZKF7fgv
bandit21 :/etc/cron.d$ cat /tmp/t7O6lds9S0RqQh9aMcz6ShpAoZKF7fgv
Yk7owGAcWjwMVRwrTesJEwB7WVOiILLI
bandit21 :/etc/cron.d$

level 22
1 | 题目信息: |
1 | bandit22 :~$ ls |
