Comments (9)
Apparently, this generates a CHECK_CAST v1, Ljava/lang/String;
in Dex. We currently ignore those, so there is no way to differentiate these, unfortunately.
from mariana-trench.
If I'm understanding the question correctly, a propagation model like this might be what you are looking for:
https://github.com/facebook/mariana-trench/blob/main/configuration/model-generators/propagations/IntentDataFeatureGenerator.json#L3-L22
This specifies that any taint that flows through the first argument of Intent.setData()
will taint the this
object and a feature called "via-intent-data" will be added to the flow.
And if I've misunderstood the question, could you provide code examples to go along with it just for clarification? Thanks!
from mariana-trench.
Hi @yuhshin-oss, I was thinking more along the lines of detecting something specific like this:
(Intent) extraIntent = getIntent().getParcelableExtra("Extra_Intent")
while excluding instances like this:
(String) extraString = getIntent().getExtras("String")
when my initial source is aimed at getParcelableExtra or getExtras.
Basically, something that would allow me the ability to stop the flow and deem it as a false positive if it was data casted into a class that I do not want.
from mariana-trench.
@yuhshin-oss this might be a bit out of scope I realise, but would like to know how to ensure that taint is propogated only through specific data type castings like above, but unsure of how to write it out
from mariana-trench.
Hi @chuayupeng, thanks for the example! Assuming the extraString
in the example is the API call like the following:
var extraString = getIntent().getExtras().getString("test");
This type of casting is done explicitly with Bundle
(or BaseBundle
)'s get[Type](...)
methods. This means that you can define models on the methods directly. In this case, adding a propagation feature like "via-bundle-getString" on the flow from "this (Argument(0))" to "return" of BaseBundle.getString()
could help. Taint will still be propagated, but any issues found will contain the feature and can be filtered out. This would look something like:
{
"find": "methods",
"where": [
{
"constraint": "signature",
"pattern": "Landroid/os/BaseBundle;.getString:(Ljava/lang/String;)Ljava/lang/String;"
}
],
"model": {
"propagations": [
{
"input": "Argument(0)",
"output": "Return",
"features": [
"via-bundle-getString"
]
}
]
}
}
from mariana-trench.
Hi @yuhshin-oss, what if the data casting is done like this?
(String) extraString = ...
That way, there is no method invocation, so was unsure of how to detect for cases like this
from mariana-trench.
Could you give another example? (String)
is not valid on the left hand side of an assignment.
from mariana-trench.
Hi @arthaud,
I want to differentiate between these 2 lines of code, so I can reduce false positives when detecting intent redirections. Is there any way to detect what the data is casted into?
Intent extraIntent = (Intent) intent.getExtras("...");
and
String extraString = (String) intent.getExtras("...");
from mariana-trench.
That should be solved with a87023d
from mariana-trench.
Related Issues (20)
- [Question] Difference between attach_to_sources and features keys. HOT 4
- Does not compile with latest fmt 9.1 due to lack of formatter for types HOT 1
- How to check argument value with regex? HOT 1
- The latest version compiles, cannot be used, and various parameters are missing. MarianaTrench mariana_trench_error: the option '--output-directory' is required but missing???
- Example code does not work HOT 3
- Taint not flowing into a sink in Runnable
- Build from source fails. HOT 1
- Stuck creating generators: Found 0 issues
- Old macOS 10.15.7 failed to execute analysis HOT 4
- Tainted data not flowing through custom propagations HOT 14
- "No such file " log in sapp HOT 3
- Request for Features Description HOT 3
- Evaluate Profile-Guided Optimization (PGO) and LLVM BOLT HOT 4
- Release app with proguard HOT 1
- Error building mariana-trench HOT 1
- verifying propagations applied to the functions. HOT 2
- ImportError when using sapp HOT 3
- Default model generators missing from PyPI release HOT 2
- Flow analysis in a method.
- Sanitizer does not work, or something wrong
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from mariana-trench.