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

Command injection warning silenced with equality operator #1199

Closed
JacobEvelyn opened this Issue May 8, 2018 · 2 comments

Comments

Projects
None yet
2 participants
@JacobEvelyn
Contributor

JacobEvelyn commented May 8, 2018

Background

Brakeman version: 4.2.1
Rails version: 5.1.6
Ruby version: 2.3.4

Issue

I expect this code to produce a command injection warning in brakeman:

def dangerous(foo)
  `echo #{foo}` == "1"
end

but the == "1" appears to prevent brakeman from spotting the vulnerability.

@JacobEvelyn

This comment has been minimized.

Contributor

JacobEvelyn commented May 8, 2018

And, relatedly, brakeman does not warn about this either:

def dangerous(foo)
  !system("echo #{foo}")
end
@presidentbeef

This comment has been minimized.

Owner

presidentbeef commented May 8, 2018

Thanks, Jake.

The first one appears to already be fixed on master.

The second one is an easy fix.

presidentbeef added a commit that referenced this issue May 9, 2018

presidentbeef added a commit that referenced this issue May 9, 2018

Repository owner locked and limited conversation to collaborators Jul 14, 2018

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.