-
Notifications
You must be signed in to change notification settings - Fork 395
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* update owasp.java.xxe.javax.xml.parsers.DocumentBuilderFactory rule * opensearch-serverless-cmk opensearch-serverless-cmk * Update terraform/aws/security/aws-opensearchserverless-encrypted-with-cmk.yaml Co-authored-by: colleend <colleen@r2c.dev> * Change message and severity of rule (#3061) * change message to reflect severity level * update severity * change message a bit --------- Co-authored-by: enno <14846866+enncoded@users.noreply.github.com> * add solidity smart contract rules * add semicolons * Add metadata (#3078) * Add metadata * Change subcategory to array * Rewrote patterns * Fixed patterns more and updated example * fix: make ruby class names constants (#3076) * fix ruby class names * a few more --------- Co-authored-by: enno <14846866+enncoded@users.noreply.github.com> * Fixed false positive with `usedforsecurity` flag in `hashlib.md5` (#3077) * Fixed false positive when unpacking safe array (#3079) --------- Co-authored-by: hocnc <nguyencaohoc52@gmail.com> Co-authored-by: FrozenSolid <frozenSolid@users.noreply.github.com> Co-authored-by: colleend <colleen@returntocorp.com> Co-authored-by: colleend <colleen@r2c.dev> Co-authored-by: enno <14846866+enncoded@users.noreply.github.com> Co-authored-by: raz0r <me@raz0r.name> Co-authored-by: Lewis <LewisArdern@live.co.uk> Co-authored-by: Brandon Wu <49291449+brandonspark@users.noreply.github.com>
- Loading branch information
1 parent
9fd26d8
commit b33db28
Showing
112 changed files
with
22,268 additions
and
51 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 |
---|---|---|
@@ -1,43 +1,63 @@ | ||
rules: | ||
- id: owasp.java.xxe.javax.xml.parsers.DocumentBuilderFactory | ||
message: >- | ||
DocumentBuilderFactory being instantiated without calling the setFeature functions that are generally used for disabling | ||
entity processing | ||
DocumentBuilderFactory being instantiated without calling the setFeature functions that are generally used for disabling entity processing, which can allow for XXE vulnerabilities | ||
metadata: | ||
cwe: "CWE-611: Improper Restriction of XML External Entity Reference" | ||
owasp: "A04:2017 - XML External Entities (XXE)" | ||
source-rule-url: https://cheatsheetseries.owasp.org//cheatsheets/XML_External_Entity_Prevention_Cheat_Sheet.html | ||
category: security | ||
technology: | ||
- java | ||
- xml | ||
cwe2022-top25: true | ||
cwe2021-top25: true | ||
references: | ||
- https://www.programcreek.com/java-api-examples/?api=javax.xml.parsers.DocumentBuilderFactory | ||
likelihood: LOW | ||
impact: HIGH | ||
subcategory: | ||
- vuln | ||
confidence: HIGH | ||
severity: ERROR | ||
patterns: | ||
# Reference: https://www.programcreek.com/java-api-examples/?api=javax.xml.parsers.DocumentBuilderFactory | ||
- pattern-either: | ||
- pattern: | | ||
DocumentBuilderFactory $DBF = ... ; | ||
... | ||
DocumentBuilder $DB = $DBF.newDocumentBuilder(); | ||
... | ||
$DB.parse(...); | ||
- pattern: DocumentBuilderFactory $DBF = DocumentBuilderFactory.newInstance().newDocumentBuilder(); | ||
- pattern-not-inside: | | ||
$RETURNTYPE $METHOD(...) { | ||
... | ||
$DBF.setXIncludeAware(true); | ||
$DBF.setNamespaceAware(true); | ||
... | ||
$DBF.setFeature("http://apache.org/xml/features/disallow-doctype-decl", true); | ||
$DBF.setFeature("http://xml.org/sax/features/external-general-entities", false); | ||
$DBF.setFeature("http://xml.org/sax/features/external-parameter-entities", false); | ||
... | ||
} | ||
- pattern-not-inside: | | ||
DocumentBuilderFactory $DBF = ... ; | ||
... | ||
$DBF.setXIncludeAware(true); | ||
$DBF.setNamespaceAware(true); | ||
... | ||
$DBF.setFeature("http://apache.org/xml/features/disallow-doctype-decl", true); | ||
$DBF.setFeature("http://xml.org/sax/features/external-general-entities", false); | ||
$DBF.setFeature("http://xml.org/sax/features/external-parameter-entities", false); | ||
- patterns: | ||
- pattern-inside: | | ||
DocumentBuilderFactory $DBF = ... ; | ||
... | ||
- pattern-inside: | | ||
DocumentBuilder $DB = $DBF.newDocumentBuilder(); | ||
... | ||
- pattern: | | ||
$DB.parse(...); | ||
- patterns: | ||
- pattern-inside: | | ||
(DocumentBuilder $DB) = (DocumentBuilderFactory $DBF).newDocumentBuilder(); | ||
... | ||
- pattern: | | ||
(DocumentBuilder $DB).parse(...); | ||
- pattern: DocumentBuilder $DB = DocumentBuilderFactory. ... .newInstance(). ... .newDocumentBuilder(); | ||
- pattern-not: | ||
patterns: | ||
- pattern-inside: | | ||
DocumentBuilderFactory $DBF = ... ; | ||
... | ||
- pattern-inside: | | ||
$DBF. ... .setXIncludeAware(true); | ||
... | ||
- pattern-inside: | | ||
$DBF. ... .setNamespaceAware(true); | ||
... | ||
- pattern-inside: | | ||
$DBF. ... .setFeature("http://apache.org/xml/features/disallow-doctype-decl", true); | ||
... | ||
- pattern-inside: | | ||
$DBF. ... .setFeature("http://xml.org/sax/features/external-general-entities", false); | ||
... | ||
- pattern-inside: | | ||
$DBF. ... .setFeature("http://xml.org/sax/features/external-parameter-entities", false); | ||
... | ||
languages: | ||
- java | ||
|
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 |
---|---|---|
@@ -1,11 +1,11 @@ | ||
class bad_cookie_serialization | ||
class Bad_cookie_serialization | ||
# ruleid: cookie-serialization | ||
Rails.application.config.action_dispatch.cookies_serializer = :hybrid | ||
# ruleid: cookie-serialization | ||
Rails.application.config.action_dispatch.cookies_serializer = :marshal | ||
end | ||
|
||
class cookie_serialization | ||
class Cookie_serialization | ||
# ok. | ||
Rails.application.config.action_dispatch.cookies_serializer = :json | ||
end |
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 |
---|---|---|
@@ -1,11 +1,11 @@ | ||
class bad_use_nested_attrs | ||
class Bad_use_nested_attrs | ||
has_one :author | ||
has_many :pages | ||
|
||
accepts_nested_attributes_for :author, :pages | ||
end | ||
|
||
class ok_use_nested_attrs | ||
class Ok_use_nested_attrs | ||
has_one :author | ||
has_many :pages | ||
end |
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 |
---|---|---|
@@ -1,4 +1,4 @@ | ||
class timing_attack | ||
class Timing_attack | ||
http_basic_authenticate_with name: "Chris", password: "LimpBizkitRules420" | ||
http_basic_authenticate_with :name => ENV["NAME"], :password => ENV["PASSWORD"] | ||
end |
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
Oops, something went wrong.