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
Dynamic: add Fuzzy token #13737
base: main
Are you sure you want to change the base?
Dynamic: add Fuzzy token #13737
Conversation
The API graph entry point depended on API::Node. This was due to depending on the the TComponent newtype which has a branch that depends on API::Node
43fbd08
to
eb5c600
Compare
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.
Python 👍
And thanks for implementing this for Python, also!
I suppose that in getAFuzzySuccessor we should make sure to avoid loops and that is why self parameters are avoided in Ruby. The Python implementation does look loop-free as far as I can tell. Do the DCA runs actually test the new feature, if we have no fuzzy specifications yet?
| conn.query(q, (err, rows) => {...}); // <-- add 'q' as a SQL injection sink | ||
| }); | ||
| We can recognize this using a fuzzy model, as showin in the following extension: |
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.
| We can recognize this using a fuzzy model, as showin in the following extension: | |
| We can recognize this using a fuzzy model, as shown in the following extension: |
| data: | ||
| - ["mysql", "Fuzzy.Member[query].Argument[0]", "sql-injection"] | ||
| - The first column, **"mysql"**, begins the search at at places where the `mysql` package is imported. |
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.
| - The first column, **"mysql"**, begins the search at at places where the `mysql` package is imported. | |
| - The first column, **"mysql"**, begins the search at places where the `mysql` package is imported. |
| In principle, this would also find expressions such as `pool.query` and `err.query`, but in practice such expressions | ||
| are not likely to occur, because the `pool` and `err` objects do not have a member named `query`. | ||
| - **Argument[0]** selects the first argument of a call to the selected member, that is, the `q` argument to `conn.query`. | ||
| - **sql-injection** indicates that this is considered a sink for the SQL injection query. |
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.
| - **sql-injection** indicates that this is considered a sink for the SQL injection query. | |
| - **sql-injection** indicates that this is considered as a sink for the SQL injection query. |
| @@ -431,6 +484,9 @@ The following components are supported: | |||
| - **MapValue** selects a value of a map object. | |||
| - **Awaited** selects the value of a promise. | |||
| - **Instance** selects instances of a class. | |||
| - **Fuzzy** selects all values that are derived from the current value through a combination of the other operations described in this list. | |||
| For example, this can be used to find all values the appear to originate from a particular package. This can be useful for finding method calls | |||
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.
| For example, this can be used to find all values the appear to originate from a particular package. This can be useful for finding method calls | |
| For example, this can be used to find all values that appear to originate from a particular package. This can be useful for finding method calls |
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.
Ruby LGTM - I've played around with this a bit and it seems potentially very useful for modeling automation.
| or | ||
| result = node.getAnElement() | ||
| or | ||
| result = node.getInstance() |
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.
I guess that this means that "FuzzyLib!;Fuzzy.<path>;test-sink" will find strictly more results than "FuzzyLib;Fuzzy.<path>;test-sink"?
Adds a
Fuzzytoken to the identifying access path for all dynamic languages, which will match, loosely speaking, an arbitrary series of operations.For example, suppose we wanted to add a SQL injection sink for the
querymethod in themysqlpackage, but we don't have a detailed enough knowledge of the library to do this precisely. So we just write the model like this:This would match all
querycalls whose receiver is an object that appears to come from themysqlpackage. The latter criterion comes from "tracking through an arbitrary series of operations".This can serve as a foundation for a dedicated extension point for fuzzy models. An entry in such a fuzzy model might simply look like: