Skip to content

Tainted data not flowing through custom propagations #129

Open
@adityavardhanpadala

Description

I am trying to verify custom propagations via a JSONObject in an APK, The source and sink are detected accurately but mt is not detecting the expected flow. Am I configuring something wrong here?
Sink:

{
  "model_generators": [
    {
      "find": "methods",
      "where":[
        {
          "constraint": "signature_match",
          "parent": "Lcom/example/flowcheck/Tainted;",
          "name": "sink"
        }
      ],
      "model": {
        "sinks": [
          {
          "kind": "TaintedSink",
          "port": "Argument(1)"
          }          
        ]
      },
      "verbosity": 2
    }
  ]
}

Source:

{
  "model_generators": [
    {
      "find": "methods",
      "where":[
        {
          "constraint": "signature_match",
          "parent": "Lcom/example/flowcheck/Tainted;",
          "name": "source"
        }
      ],
      "model": {
        "source": [
          {
          "kind": "TaintedSource",
          "port": "Return"
          }
        ]
      },
      "verbosity": 2
    }
  ]
}

Propagation:
The idea here is to taint return value of get* and taint the object itself for put* in org.json.JSONObject's methods.

{
    "model_generators" : [
      {
       "find": "methods",
       "where": [
         {
          "constraint": "signature_match",
          "parent": "Lorg/json/JSONObject;",
          "name": "<init>"
         }
       ],
       "model": {
          "propagation": [
            {
              "input": "Argument(1)",
              "output": "Return"
            }
          ]
       }
      },
      {
       "find": "methods",
       "where": [
         {
          "constraint": "signature_match",
          "parent": "Lorg/json/JSONObject;",
          "name": "*get*"
         }
       ],
       "model": {
          "propagation": [
            {
              "input": "Argument(0)",
              "output": "Return"
            }
          ]
       }
      },
      {
       "find": "methods",
       "where": [
         {
          "constraint": "signature_match",
          "parent": "Lorg/json/JSONObject;",
          "name": "*put*"
         }
       ],
       "model": {
          "propagation": [
            {
              "input": "Argument(2)",
              "output": "Argument(0)"
            }
          ]
        }
      }
    ]
}

rules.json

[
  {
    "name": "Propagation Test",
    "code": 1,
    "description": "Values from source may eventually flow into sink",
    "sources": [
      "TaintedSource"
    ],
    "sinks": [
      "TaintedSink"
    ]
  }
]

default-model-generator.json

[
  {
    "name": "TaintedSink"
  },
  {
    "name": "TaintedSource"
  }
]

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions