This repo contains Manual Analysis Results for the NativeSummary paper.
Initially, we intended to use a Google Docs tables to present our data, but it cannot collapse table blocks, and only Enterprise version support the code block. So we created a webpage for the data.
Open this link:
The HTML file is intended to be a single self-contained webpage, you can also download and open it locally.
Here we present an example of our manual analysis process.
- First, We fill in the APK name, source and sink, native parts of the dataflow first.
- Here, the apk name: com.sgr_b2.compass_18.apk
- Native part:
$f0 = staticinvoke <com.sgr_b2.compass.jni.CCJNI: float cmps_sanitize_lon(float)>($f0)
- Then, we search for the classname for source code. Or go to the F-Droid apk page, find the source code.
- Search "com.sgr_b2.compass" and find repo, search "cmps_sanitize_lon" to find the function
- Source code: https://bitbucket.org/alekseyt/compass/src/92a4381be7a51efc4d1939851f17b5d513a1bc52/jni/libcompass/utils.c?at=master#lines-11:14
- Then, we find the Jimple IR, and check if the data flow is correct.
- the dataflow propogate from the argument to the return value.
Full Flow:
<Source Statement="$r3 = virtualinvoke $r1.<java.text.DecimalFormat: java.lang.Number parse(java.lang.String)>($r0)" Method="<com.sgr_b2.compass.ui.d: float a(java.lang.String)>">
<AccessPath Value="$r3" Type="java.lang.Number" TaintSubFields="true" />
<TaintPath>
<PathElement Statement="$r3 = virtualinvoke $r1.<java.text.DecimalFormat: java.lang.Number parse(java.lang.String)>($r0)" Method="<com.sgr_b2.compass.ui.d: float a(java.lang.String)>">
<AccessPath Value="$r3" Type="java.lang.Number" TaintSubFields="true" />
</PathElement>
<PathElement Statement="$f0 = virtualinvoke $r3.<java.lang.Number: float floatValue()>()" Method="<com.sgr_b2.compass.ui.d: float a(java.lang.String)>">
<AccessPath Value="$f0" Type="float" TaintSubFields="true" />
</PathElement>
<PathElement Statement="return $f0" Method="<com.sgr_b2.compass.ui.d: float a(java.lang.String)>">
<AccessPath Value="$f1" Type="float" TaintSubFields="true" />
</PathElement>
<PathElement Statement="$f1 = staticinvoke <com.sgr_b2.compass.jni.k: float b(float)>($f1)" Method="<com.sgr_b2.compass.activities.AddEditActivity: void onClick(android.view.View)>">
<AccessPath Value="$f0" Type="float" TaintSubFields="true" />
</PathElement>
<PathElement Statement="$f0 = staticinvoke <com.sgr_b2.compass.jni.CCJNI: float cmps_sanitize_lon(float)>($f0)" Method="<com.sgr_b2.compass.jni.k: float b(float)>">
<AccessPath Value="$f0" Type="float" TaintSubFields="true" />
</PathElement>
<PathElement Statement="return $f0" Method="<com.sgr_b2.compass.jni.CCJNI: float cmps_sanitize_lon(float)>">
<AccessPath Value="$f0" Type="float" TaintSubFields="true" />
</PathElement>
<PathElement Statement="return $f0" Method="<com.sgr_b2.compass.jni.k: float b(float)>">
<AccessPath Value="$f1" Type="float" TaintSubFields="true" />
</PathElement>
<PathElement Statement="specialinvoke r0.<com.sgr_b2.compass.activities.AddEditActivity: void a(java.lang.String,float,float)>($r4, $f0, $f1)" Method="<com.sgr_b2.compass.activities.AddEditActivity: void onClick(android.view.View)>">
<AccessPath Value="$f1" Type="float" TaintSubFields="true" />
</PathElement>
<PathElement Statement="specialinvoke $r5.<com.sgr_b2.compass.a.d: void <init>(float,float,java.lang.String,int)>($f0, $f1, $r1, $i0)" Method="<com.sgr_b2.compass.activities.AddEditActivity: void a(java.lang.String,float,float)>">
<AccessPath Value="$f1" Type="float" TaintSubFields="true" />
</PathElement>
<PathElement Statement="r0.<com.sgr_b2.compass.a.d: float d> = $f1" Method="<com.sgr_b2.compass.a.d: void <init>(float,float,java.lang.String,int)>">
<AccessPath Value="r0" Type="com.sgr_b2.compass.a.d" TaintSubFields="true">
<Fields>
<Field Value="<com.sgr_b2.compass.a.d: float d>" Type="float" />
</Fields>
</AccessPath>
</PathElement>
<PathElement Statement="return" Method="<com.sgr_b2.compass.a.d: void <init>(float,float,java.lang.String,int)>">
<AccessPath Value="$r5" Type="com.sgr_b2.compass.a.d" TaintSubFields="true">
<Fields>
<Field Value="<com.sgr_b2.compass.a.d: float d>" Type="float" />
</Fields>
</AccessPath>
</PathElement>
<PathElement Statement="virtualinvoke $r2.<com.sgr_b2.compass.a.a: void b(com.sgr_b2.compass.a.d)>($r5)" Method="<com.sgr_b2.compass.activities.AddEditActivity: void a(java.lang.String,float,float)>">
<AccessPath Value="$r1" Type="com.sgr_b2.compass.a.d" TaintSubFields="true">
<Fields>
<Field Value="<com.sgr_b2.compass.a.d: float d>" Type="float" />
</Fields>
</AccessPath>
</PathElement>
<PathElement Statement="$f0 = $r1.<com.sgr_b2.compass.a.d: float d>" Method="<com.sgr_b2.compass.a.a: void b(com.sgr_b2.compass.a.d)>">
<AccessPath Value="$f0" Type="float" TaintSubFields="true" />
</PathElement>
<PathElement Statement="$r3 = staticinvoke <java.lang.Float: java.lang.Float valueOf(float)>($f0)" Method="<com.sgr_b2.compass.a.a: void b(com.sgr_b2.compass.a.d)>">
<AccessPath Value="$r3" Type="java.lang.Float" TaintSubFields="true" />
</PathElement>
<PathElement Statement="virtualinvoke $r2.<android.content.ContentValues: void put(java.lang.String,java.lang.Float)>("lon", $r3)" Method="<com.sgr_b2.compass.a.a: void b(com.sgr_b2.compass.a.d)>">
<AccessPath Value="$r3" Type="java.lang.Float" TaintSubFields="true" />
</PathElement>
</TaintPath>
</Source>Source Code:
// https://bitbucket.org/alekseyt/compass/src/92a4381be7a51efc4d1939851f17b5d513a1bc52/jni/libcompass/utils.c?at=master#lines-11:14
float cmps_sanitize_lon(float lon) {
return (lon < -180 ? -180 : (
lon > 180 ? 180 : lon));
}Jimple IR:
public static float cmps_sanitize_lon(float)
{
float $p0;
$p0 := @parameter0;
return $p0;
}