Skip to content

Commit

Permalink
Merge pull request #2953 from returntocorp/merge-develop-to-release
Browse files Browse the repository at this point in the history
Merge Develop into Release
  • Loading branch information
kurt-r2c committed Jun 13, 2023
2 parents 08ca2f0 + d1a06b3 commit a5745ac
Show file tree
Hide file tree
Showing 5 changed files with 104 additions and 2 deletions.
2 changes: 2 additions & 0 deletions c/lang/security/function-use-after-free.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@ rules:
free($VAR);
...
- pattern-not-inside:
free($VAR);
...
$VAR = NULL;
...
- pattern-not-inside:
Expand Down
49 changes: 49 additions & 0 deletions java/android/security/exported_activity.AndroidManifest.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools">

<application
android:allowBackup="true"
android:dataExtractionRules="@xml/data_extraction_rules"
android:fullBackupContent="@xml/backup_rules"
android:icon="@mipmap/ic_launcher"
android:label="@string/app_name"
android:roundIcon="@mipmap/ic_launcher_round"
android:supportsRtl="true"
android:theme="@style/Theme.Demo_web"
tools:targetApi="31">
<!-- ok: exported_activity -->
<activity
android:name=".cool"
android:exported="false">
<meta-data
android:name="android.app.lib_name"
android:value="" />
</activity>
<!-- ruleid: exported_activity -->
<activity
android:name=".MainActivity2">
<intent-filter>
<action android:name="android.intent.action.GET_CONTENT"/>
</intent-filter>
<meta-data
android:name="android.app.lib_name"
android:value="" />
</activity>
<!-- ruleid: exported_activity -->
<activity
android:name=".MainActivity"
android:exported="true">
<intent-filter>
<action android:name="android.intent.action.MAIN" />

<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>

<meta-data
android:name="android.app.lib_name"
android:value="" />
</activity>
</application>

</manifest>
41 changes: 41 additions & 0 deletions java/android/security/exported_activity.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
rules:
- id: exported_activity
patterns:
- pattern-not-inside: <activity ... android:exported="false" ... />
- pattern-inside: "<activity ... /> \n"
- pattern-either:
- pattern: |
<activity ... android:exported="true" ... />
- pattern: |
<activity ... <intent-filter> ... />
message: Use of Exported Activity
languages:
- generic
severity: WARNING
paths:
exclude:
- sources/
- classes3.dex
- '*.so'
include:
- '*AndroidManifest.xml'
metadata:
vulnerability: Use of exported components
Description: >-
The application exports an activity. Any application on the device can launch the exported activity which may compromise the integrity of your application or its data.
Ensure that any exported activities do not have privileged access to your application's control plane.
Severity: HIGH
category: security
subcategory:
- vuln
cwe:
- 'CWE-926: Improper Export of Android Application Components'
confidence: MEDIUM
likelihood: MEDIUM
impact: MEDIUM
owasp:
- A5:2021 Security Misconfiguration
technology:
- Android
references:
- https://cwe.mitre.org/data/definitions/926.html
7 changes: 7 additions & 0 deletions ruby/rails/security/injection/tainted-sql-string.rb
Original file line number Diff line number Diff line change
Expand Up @@ -92,5 +92,12 @@ def ok_test5
redirect_to "#{authenticator_domain}/application-name/landing?redirect_path=#{redirect_url}"
end

def ok_test6
# ok:tainted-sql-string
user = User.where(user_id: params[:user_id])[0]
# ok:tainted-sql-string
user = User.where(params.slice(:user_id))[0]
end

end

7 changes: 5 additions & 2 deletions ruby/rails/security/injection/tainted-sql-string.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,11 @@ rules:
- pattern-either:
- patterns:
- pattern-either:
- pattern: |
$RECORD.where($X,...)
- patterns:
- pattern: |
$RECORD.where($X,...)
- pattern-not: |
$RECORD.where($PARAMS.slice(...), ...)
- pattern: |
$RECORD.find(..., :conditions => $X,...)
- focus-metavariable: $X
Expand Down

0 comments on commit a5745ac

Please sign in to comment.