Skip to content
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

Python OS Command Execution via Examples #60

Open
wdahlenburg opened this issue Jan 26, 2024 · 0 comments
Open

Python OS Command Execution via Examples #60

wdahlenburg opened this issue Jan 26, 2024 · 0 comments

Comments

@wdahlenburg
Copy link

Description

All of the Python SSE servers currently support arbitrary command injection. Some of the other examples do a better job restricting functions to expected code input.

Mutual TLS should be in front of these servers, but in case it's not configured anyone can execute arbitrary OS commands fairly easily against the examples.

The eval and exec functions are unsafe for user input. It'd be good to update the examples with a more secure server for users to use as a template.

Steps to Reproduce

  1. Set up a Qlik analytic connection and run any of the example Python servers, such as helloworld
  2. Configure the extension editor in Qlik to run SSEPython.ScriptEvalStr('__import__("os").popen("ls -la").read()', HelloWorldData). Modify the output field if not using the SSE_Hello_World.qvf to another string field.
  3. Apply the expression and observe that the server executes ls -la on the host.

For columnoperations:
SSEPython.ScriptEval('__import__("os").popen("ls -la").read()', [], HelloWorldData)

For fullscriptsupport_pandas (which used exec instead of eval):
SSEPython.ScriptEval('__import__("os").popen("touch /tmp/x").read()')

The fullscriptsupport example can use the same payload as the helloworld example.

Expected behavior

The example servers should be secure against remote code execution vulnerabilities.

Actual behavior

Unexpected users can execute OS commands on servers hosting the Python examples.

Environment

Operating system
[ ] Windows
[X] Linux
Qlik Sense
[ ] Desktop
[X] Server

Versions

  • server-side-extension: Latest
  • Qlik Sense:
  • Operating system:
  • [Other relevant versions]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant