Skip to content

Files

Latest commit

 

History

History
23 lines (15 loc) · 613 Bytes

GitlabSecurity-SystemCommandInjection.md

File metadata and controls

23 lines (15 loc) · 613 Bytes

Pattern: Use of system("/bin/ls #{params[:file]}")

Issue: -

Description

Check for use of system("/bin/ls #{params[:file]}"). Passing user input to system() without sanitization and parameterization can result in command injection.

Examples

# bad
system("/bin/ls #{filename}")

# good (parameters)
system("/bin/ls", filename)
# even better
exec("/bin/ls", shell_escape(filename))

Further Reading