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

format string attack false positive? #7

Open
geeknik opened this issue Nov 27, 2015 · 3 comments
Open

format string attack false positive? #7

geeknik opened this issue Nov 27, 2015 · 3 comments

Comments

@geeknik
Copy link

geeknik commented Nov 27, 2015

Why would GrepBugs flag this as "Susceptible to format string attacks. "?

fprintf(stderr, "Other helper already running, refusing to start.\n");`

Is it just triggering on the fprintf or something else?

@foospidy
Copy link
Owner

The rule is defined here: https://grepbugs.com/grep/94 so looks like it is triggered just based on fprintf. This will of course be noisy. If you have any suggestions that could make the rule better, description or regex, that would be awesome.

@geeknik
Copy link
Author

geeknik commented Nov 27, 2015

I'll work on that and get back to you. I'll leave this open in the meantime if that is ok.

@veggiespam
Copy link
Contributor

The regex is basic, just a printf trigger. Maybe this is acceptable: printf(, then double quote, [^"%]-star (no double quote or percent), double quote, paren. Anything else would be bad. Any var-arg could be attacked, so no commas, only one argument.

printf(variable_name) could be problematic if there is a % in the string. Or worse, if the variable is a var_arg variable type. Thus, I would argue static string only.

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

3 participants