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

Usage of -analyzer-checker=alpha.security.taint.TaintPropagation:Config does not work #3921

Open
ShangzhiXu opened this issue May 23, 2023 · 1 comment
Assignees
Labels
analyzer 📈 Related to the analyze commands (analysis driver) CLI 💻 Related to the command-line interface, such as the cmd, store, etc. commands

Comments

@ShangzhiXu
Copy link

Hi, sorry for bothering. I met with a problem that while I was trying to use taint analysis with my own source-sink yaml file, the following command line does not work:

CodeChecker analyze --analyzers clangsa -j16 xxx/compilation.json -e alpha.security.taint.TaintPropagation  --checker-config 'clangsa:alpha.security.taint.TaintPropagation:Config=xxx/test/test_memcpy/config.yaml'     --ctu --output ./reports

And here is my target file:

#include <stdio.h>
#include <string.h>
#include <stdlib.h>

void vulnerableFunction(char* input) {
   char buffer[10];
   strcpy(buffer, input); // Vulnerability: No bounds checking on the input
   
}
int main() {
  unsigned char inputString[200] = {};
  fgets(inputString, sizeof(inputString), stdin);
  vulnerableFunction(inputString);
  return 0;
}

And my config.yaml is:

Filters:
Propagations:
  - Name: fgets
    DstArgs: [0]

Sinks:
  - Name: strcpy
    Args: [0]

There is supposed to be an untrusted variable bug been detected but it turned out that there is no report :(

I followed the user guide :

CodeChecker analyze \
  -e alpha.security.taint.TaintPropagation \
  --checker-config 'clangsa:alpha.security.taint.TaintPropagation:Config=my-cutom-taint-config.yaml'

I'm not sure if it is because I made any mistake in my usage.
Really sorry for bothering.

@bruntib
Copy link
Contributor

bruntib commented Jun 21, 2023

Hi @ShangzhiXu,

Unfortunately I'm not aware of the behavior of TaintPropagation checker. But if I use sprintf() instead of strcpy() in the attached source code then this checker emits a report for me. I'm not sure, if not reporting on strcpy() is a false-negative of the checker, or I just simply don't understand how the checker works. Someone from the Clang community could help us, perhaps. But maybe you can continue the investigation of the config file's usage with changing sprintf() to strcpy().

I'm looking forward to hear your experiences about this example.
Thank you!

@whisperity whisperity changed the title Usage of ‘-analyzer-checker=alpha.security.taint.TaintPropagation:Config’ does not work Usage of -analyzer-checker=alpha.security.taint.TaintPropagation:Config does not work Oct 19, 2023
@whisperity whisperity added CLI 💻 Related to the command-line interface, such as the cmd, store, etc. commands analyzer 📈 Related to the analyze commands (analysis driver) labels Oct 19, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
analyzer 📈 Related to the analyze commands (analysis driver) CLI 💻 Related to the command-line interface, such as the cmd, store, etc. commands
Projects
None yet
Development

No branches or pull requests

4 participants