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
WIP : Swift: Add Command Injection query #13726
base: main
Are you sure you want to change the base?
WIP : Swift: Add Command Injection query #13726
Conversation
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.
Hi @maikypedia , this query looks great! You've marked it as a work-in-progress so I'll just make a few small comments for now. When you're ready we can either do a more detailed review (and add some tests) - or we can just merge your work it into an 'experimental' directory if you'd prefer us to take it from there.
swift/ql/lib/codeql/swift/security/CommandInjectionExtensions.qll
Outdated
Show resolved
Hide resolved
swift/ql/lib/codeql/swift/security/CommandInjectionExtensions.qll
Outdated
Show resolved
Hide resolved
| <overview> | ||
| <p> | ||
| Constructing a system command with unsanitized user input is dangerous, | ||
| since a malicious user to execute code. |
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.
| since a malicious user to execute code. | |
| since a malicious user may be able to craft input that executes arbitrary code. |
| </p> | ||
| <sample src="CommandInjectionBad.swift" /> | ||
| <p> | ||
| If user input is used to construct a regular expression it should be checked |
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.
| If user input is used to construct a regular expression it should be checked | |
| If user input is used to construct a command it should be checked |
| * @precision high | ||
| * @id swift/command-line-injection | ||
| * @tags security | ||
| * external/cwe/cwe-078 |
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.
CWE-88 is also relevant.
| * external/cwe/cwe-078 | |
| * external/cwe/cwe-078 | |
| * external/cwe/cwe-088 |


WIP