-
Notifications
You must be signed in to change notification settings - Fork 38
F 739 : fix shell command injection #213
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
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -25,5 +25,39 @@ fi | |||||||||||||||||||
|
|
||||||||||||||||||||
| rm tmp.crt | ||||||||||||||||||||
|
|
||||||||||||||||||||
| # Regression tests: shell injection via hostname must not execute injected command. | ||||||||||||||||||||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🟡 [Medium] Missing backtick command-substitution injection test case The regression tests cover three shell injection vectors: semicolons ( Suggestion:
Suggested change
|
||||||||||||||||||||
| # Applies to the WOLFSSL_USE_POPEN_HOST path where peer is concatenated into a | ||||||||||||||||||||
| # popen() shell command. On other builds, getaddrinfo/gethostbyname reject | ||||||||||||||||||||
| # these hostnames before any shell is involved, so the tests pass either way. | ||||||||||||||||||||
| INJFILE="clu_injection_probe.txt" | ||||||||||||||||||||
| rm -f "$INJFILE" | ||||||||||||||||||||
|
|
||||||||||||||||||||
| # Semicolon: "evil.com;touch clu_injection_probe.txt" passed as peer | ||||||||||||||||||||
| ./wolfssl s_client -connect 'evil.com;touch clu_injection_probe.txt:443' \ | ||||||||||||||||||||
| 2>/dev/null | ||||||||||||||||||||
miyazakh marked this conversation as resolved.
Show resolved
Hide resolved
|
||||||||||||||||||||
| if [ -f "$INJFILE" ]; then | ||||||||||||||||||||
| echo "SECURITY FAILURE: command injection via hostname (semicolon)" | ||||||||||||||||||||
| rm -f "$INJFILE" | ||||||||||||||||||||
| exit 99 | ||||||||||||||||||||
| fi | ||||||||||||||||||||
|
|
||||||||||||||||||||
| # Command substitution: "$(touch clu_injection_probe.txt)" passed as peer | ||||||||||||||||||||
| ./wolfssl s_client -connect 'evil$(touch clu_injection_probe.txt).com:443' \ | ||||||||||||||||||||
| 2>/dev/null | ||||||||||||||||||||
miyazakh marked this conversation as resolved.
Show resolved
Hide resolved
|
||||||||||||||||||||
| if [ -f "$INJFILE" ]; then | ||||||||||||||||||||
| echo "SECURITY FAILURE: command injection via hostname (command substitution)" | ||||||||||||||||||||
| rm -f "$INJFILE" | ||||||||||||||||||||
| exit 99 | ||||||||||||||||||||
| fi | ||||||||||||||||||||
|
|
||||||||||||||||||||
| # Pipe: "evil.com|touch clu_injection_probe.txt" passed as peer | ||||||||||||||||||||
| ./wolfssl s_client -connect 'evil.com|touch clu_injection_probe.txt:443' \ | ||||||||||||||||||||
| 2>/dev/null | ||||||||||||||||||||
miyazakh marked this conversation as resolved.
Show resolved
Hide resolved
|
||||||||||||||||||||
| if [ -f "$INJFILE" ]; then | ||||||||||||||||||||
| echo "SECURITY FAILURE: command injection via hostname (pipe)" | ||||||||||||||||||||
| rm -f "$INJFILE" | ||||||||||||||||||||
| exit 99 | ||||||||||||||||||||
| fi | ||||||||||||||||||||
|
|
||||||||||||||||||||
| echo "Done" | ||||||||||||||||||||
| exit 0 | ||||||||||||||||||||
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.
🔵 [Low]
#include <ctype.h>placed between wolfSSL headers🔧 NIT
conventionThe new
#include <ctype.h>is placed on line 37 betweenwolfssl/wolfcrypt/settings.h(line 35) andwolfssl/ssl.h(line 39). In wolfSSL convention,settings.his typically followed immediately by other wolfSSL headers since it sets up preprocessor macros those headers depend on. System includes are conventionally grouped together. The include is needed (for the pre-existingisalpha()call on line 142), so adding it explicitly is correct — only the placement is slightly off.Suggestion: