This repository has been archived by the owner on Nov 28, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 953
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #576 from wufeifei/develop
Released v2.0.0-alpha.4
- Loading branch information
Showing
66 changed files
with
1,112 additions
and
147 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -7,7 +7,7 @@ | |
__issue_page__ = 'https://github.com/wufeifei/cobra/issues/new' | ||
__python_version__ = sys.version.split()[0] | ||
__platform__ = platform.platform() | ||
__version__ = '2.0.0-alpha.3' | ||
__version__ = '2.0.0-alpha.4' | ||
__author__ = 'Feei' | ||
__author_email__ = '[email protected]' | ||
__license__ = 'MIT License' | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,7 +3,6 @@ | |
<name value="get_headers导致的SSRF"/> | ||
<language value="php"/> | ||
<match mode="function-param-controllable"><![CDATA[get_headers]]></match> | ||
<repair block="in-function-up"><![CDATA[in_array\s*\(\s*{{PARAM}}\s*,|preg_match(?:_all)?\s*\(\s*(?:.+?)\s*,\s*{{PARAM}}\s*[,\)]]]></repair> | ||
<level value="7"/> | ||
<test> | ||
<case assert="true"><![CDATA[ | ||
|
@@ -41,5 +40,5 @@ | |
``` | ||
</solution> | ||
<status value="on"/> | ||
<author name="Lightless" email="[email protected]"/> | ||
<author name="Lightless" email="[email protected]"/> | ||
</cobra> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<cobra document="https://github.com/wufeifei/cobra"> | ||
<name value="fsockopen造成的SSRF"/> | ||
<language value="php"/> | ||
<match mode="function-param-controllable"><![CDATA[fsockopen]]></match> | ||
<level value="7"/> | ||
<test> | ||
<case assert="true"><![CDATA[ | ||
$host = $_GET['host']; | ||
$fp = fsockopen($host, intval($port), $errno, $errstr, 30); | ||
]]></case> | ||
</test> | ||
<solution> | ||
## 安全风险 | ||
SSRF漏洞(Server-Side Request Forgery) | ||
|
||
### 形成原理 | ||
SSRF形成的原因大都是由于服务端提供了从其他服务器应用获取数据的功能且没有对目标地址做过滤与限制。 | ||
|
||
### 风险 | ||
1、攻击者可以对外网、服务器所在内网、本地进行端口扫描,获取服务的banner信息。 | ||
2、攻击运行在内网或本地的应用程序。 | ||
3、对内网web应用进行指纹识别。 | ||
4、攻击内外网的web应用。 | ||
5、利用file协议读取本地文件等。 | ||
|
||
## 修复方案 | ||
1. 限制协议为HTTP、HTTPS | ||
2. 限制请求域名白名单 | ||
3. 禁止30x跳转 | ||
|
||
</solution> | ||
<status value="on"/> | ||
<author name="JoyChou" email="[email protected]"/> | ||
</cobra> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<cobra document="https://github.com/wufeifei/cobra"> | ||
<name value="LDAP注入"/> | ||
<language value="php"/> | ||
<match mode="function-param-controllable"><![CDATA[(ldap_add|ldap_delete|ldap_list|ldap_read|ldap_search|ldap_bind)]]></match> | ||
<repair block="in-function-up"><![CDATA[ldap_escape\s*\(\s*.+?\s*,\s*.+?\s*,\s*LDAP_ESCAPE_FILTER\s*\)]]></repair> | ||
<level value="5"/> | ||
<test> | ||
<case assert="true"><![CDATA[ | ||
$surname=$_GET['surname']; | ||
$filter = "(sn=" . $surname . ")"; | ||
$sr=ldap_search($ds, "o=My Company, c=US", $filter); | ||
$info = ldap_get_entries($ds, $sr); | ||
]]></case> | ||
</test> | ||
<solution> | ||
## 安全风险 | ||
|
||
LDAP Injection | ||
允许进行LDAP查询 + 输入未进行过滤 ---> LDAP注入 | ||
这种威胁可以让攻击者能够从LADP树中提取到很多很重要的信息 | ||
|
||
## 修复方案 | ||
对用户输入数据中包含的”语言本身的保留字符”进行转义(例如可以使用`ldap_escape`) | ||
|
||
</solution> | ||
<status value="on"/> | ||
<author name="Feei" email="[email protected]"/> | ||
</cobra> | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -7,17 +7,13 @@ | |
<level value="5"/> | ||
<test> | ||
<case assert="true"><![CDATA[ | ||
<?php | ||
$xml = $_POST['xml']; | ||
$data = simplexml_load_string($xml); | ||
?> | ||
]]></case> | ||
<case assert="false"><![CDATA[ | ||
<?php | ||
$xml = $_POST['xml']; | ||
libxml_disable_entity_loader(true); | ||
$data = simplexml_load_string($xml); | ||
?> | ||
]]></case> | ||
</test> | ||
<solution> | ||
|
@@ -42,18 +38,15 @@ | |
|
||
## 举例 | ||
```php | ||
<?php | ||
$xml = $_POST['xml']; | ||
$data = simplexml_load_string($xml); | ||
?> | ||
``` | ||
修改后代码 | ||
```php | ||
<?php | ||
$xml = $_POST['xml']; | ||
libxml_disable_entity_loader(true); | ||
$data = simplexml_load_string($xml); | ||
?> | ||
``` | ||
</solution> | ||
<status value="on"/> | ||
<author name="Lightless" email="[email protected] "/> | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.