Skip to content

Commit

Permalink
Merge pull request #2967 from returntocorp/merge-develop-to-release
Browse files Browse the repository at this point in the history
Merge Develop into Release
  • Loading branch information
enncoded committed Jun 20, 2023
2 parents 748e2dc + bab3d93 commit 50c9e16
Show file tree
Hide file tree
Showing 10 changed files with 17 additions and 65 deletions.
1 change: 0 additions & 1 deletion java/log4j/security/log4j-message-lookup-injection.java
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ public class VulnerableLog4jExampleHandler implements HttpHandler {

public void handle(HttpExchange he) throws IOException {
string userAgent = he.getRequestHeader("user-agent");
// ruleid: log4j-message-lookup-injection
log.info("Request User Agent:" + userAgent);

}
Expand Down
17 changes: 4 additions & 13 deletions java/log4j/security/log4j-message-lookup-injection.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -18,19 +18,10 @@ rules:
- audit
likelihood: LOW
impact: HIGH
message: Possible Lookup injection into Log4j messages. Lookups provide a way to add values to the Log4j
messages at arbitrary places. If the message parameter contains an attacker controlled string, the
attacker could inject arbitrary lookups, for instance '${java:runtime}'. This could lead to information
disclosure or even remote code execution if 'log4j2.formatMsgNoLookups' is disabled. This was disabled
by default until version 2.15.0.
mode: taint
pattern-sources:
- patterns:
- pattern: public $T $M(...) # audit rule until it can checked < 2.15.0
pattern-sinks:
- patterns:
- pattern: |
(org.apache.log4j.Logger $L).$M(...)
message: This rule is deprecated.
patterns:
- pattern: a()
- pattern: b()
severity: WARNING
languages:
- java
4 changes: 0 additions & 4 deletions ruby/lang/security/nested-attributes-bypass.rb
Original file line number Diff line number Diff line change
@@ -1,16 +1,12 @@
def bad_nested_attributes_bypass
# ruleid: nested-attributes-bypass
accepts_nested_attributes_for allow_destroy: false

# ruleid: nested-attributes-bypass
accepts_nested_attributes_for :avatar, :book, allow_destroy: false

# ruleid: nested-attributes-bypass
accepts_nested_attributes_for :avatar, :book, allow_destroy: false, :name
end

def ok_nested_attributes_bypass
has_one :avatar
# ok: nested-attributes-bypass
accepts_nested_attributes_for :avatar, allow_destroy: true
end
14 changes: 4 additions & 10 deletions ruby/lang/security/nested-attributes-bypass.yaml
Original file line number Diff line number Diff line change
@@ -1,14 +1,6 @@
rules:
- id: nested-attributes-bypass
message: >-
Checks for nested attributes vulnerability (CVE-2015-7577). Setting allow_destroy:
false in
accepts_nested_attributes_for can lead to attackers setting attributes to invalid
values and clearing all attributes.
This affects versions 3.1.0 and newer, with fixed versions 5.0.0.beta1.1, 4.2.5.1,
4.1.14.1, 3.2.22.1.
To fix, upgrade to a newer version or use the initializer specified in the google
groups.
message: This rule is deprecated.
metadata:
cwe:
- 'CWE-915: Improperly Controlled Modification of Dynamically-Determined Object Attributes'
Expand All @@ -28,4 +20,6 @@ rules:
languages:
- ruby
severity: WARNING
pattern: 'accepts_nested_attributes_for ..., allow_destroy: false, ...'
patterns:
- pattern: a()
- pattern: b()
2 changes: 0 additions & 2 deletions ruby/rails/security/audit/mime-type-dos.rb
Original file line number Diff line number Diff line change
@@ -1,10 +1,8 @@
def bad(string, symbol, mime_type_synonyms = [], extension_synonyms = [], skip_lookup = false)
# ruleid: mime-type-dos
Mime.const_set(symbol.to_s.upcase, Type.new(string, symbol, mime_type_synonyms))
end

def ok()
# ok: mime-type-dos
Mime.const_set :LOOKUP, Hash.new { |h,k|
Mime::Type.new(k) unless k.blank?
}
Expand Down
14 changes: 3 additions & 11 deletions ruby/rails/security/audit/mime-type-dos.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -16,17 +16,9 @@ rules:
likelihood: LOW
impact: HIGH
confidence: LOW
message: >-
Detected usage of `Mime.const_set`. This could lead to a Denial of Service attack,
as an attacker could send lots of different mime types to the server,
causing the cache to grow large and use all available RAM.
Make sure you are using 5.0.0.beta1.1, 4.2.5.1, 4.1.14.1, 3.2.22.1 or higher. If this is not possible,
use the workaround with "Mime.const_set :LOOKUP, Hash.new { |h,k| Mime::Type.new(k) unless k.blank?
}"
message: This rule is deprecated.
languages: [ruby]
severity: WARNING
patterns:
- pattern: |
Mime.const_set ...
- pattern-not: |
Mime.const_set :LOOKUP, ...
- pattern: a()
- pattern: b()
3 changes: 0 additions & 3 deletions ruby/rails/security/audit/rails-check-page-caching-cve.rb
Original file line number Diff line number Diff line change
@@ -1,15 +1,12 @@
class CachingController < ApplicationController
# ruleid: rails-check-page-caching-cve
caches_page :show
end

class CachingController2 < ApplicationController
# ruleid: rails-check-page-caching-cve
caches_page :uhoh
end

class SafeController < ApplicationController
# ok
asdf :show
end

13 changes: 3 additions & 10 deletions ruby/rails/security/audit/rails-check-page-caching-cve.yaml
Original file line number Diff line number Diff line change
@@ -1,16 +1,9 @@
rules:
- id: rails-check-page-caching-cve
patterns:
- pattern-inside: |
class $CONTROLLER < $BIGCONTROLLER
...
end
- pattern: |
caches_page :$ACTION
message: >-
All versions below 1.2.1 of the 'actionpack_page-caching' gem are vulnerable to arbitrary file write
and remote code execution (CVE-2020-8159) when using caching methods. Update to version 1.2.1 or greater
or remove calls to 'caches_page'.
- pattern: a()
- pattern: b()
message: This rule is deprecated.
languages:
- ruby
severity: WARNING
Expand Down
2 changes: 0 additions & 2 deletions ruby/rails/security/audit/rails-check-render-dos-cve.rb
Original file line number Diff line number Diff line change
@@ -1,10 +1,8 @@
class Text < ApplicationController
# ruleid: rails-check-render-dos
render :hello
end

class Text < ApplicationController
# ok
send :hello
end

12 changes: 3 additions & 9 deletions ruby/rails/security/audit/rails-check-render-dos-cve.yaml
Original file line number Diff line number Diff line change
@@ -1,15 +1,9 @@
rules:
- id: rails-check-render-dos
patterns:
- pattern-inside: |
class $CONTROLLER < $BIGCONTROLLER
...
end
- pattern: |
render :$TEXT
message: The render method in Rails versions 3.0.0 - 3.0.20, 3.1.0 - 3.1.12, and 3.2.0 - 3.2.16 are
vulnerable to a denial of service attack (CVE-2014-0082), which could lead to service downtime. Upgrade
to 3.2.17 or higher instead.
- pattern: a()
- pattern: b()
message: This rule is deprecated.
languages:
- generic
severity: WARNING
Expand Down

0 comments on commit 50c9e16

Please sign in to comment.