From c745b6ace4bfaf2c8fe3dbab4e1c000c5223b859 Mon Sep 17 00:00:00 2001 From: MaxMilshin Date: Tue, 11 Jun 2024 04:14:34 +0300 Subject: [PATCH] add tests for sql injection --- .../org/jacodb/analysis/util/PandaTraits.kt | 7 +- .../jacodb/panda/dynamic/parser/IRParser.kt | 5 + .../src/test/kotlin/analysis/TaintSamples.kt | 45 +- .../samples/taintSamples/SQLInjection2.json | 3060 +++++++++++++++++ .../samples/taintSamples/SQLInjection2.ts | 45 + .../samples/taintSamples/SQLInjection3.json | 2509 ++++++++++++++ .../samples/taintSamples/SQLInjection3.ts | 37 + 7 files changed, 5697 insertions(+), 11 deletions(-) create mode 100644 jacodb-panda-dynamic/src/test/resources/samples/taintSamples/SQLInjection2.json create mode 100644 jacodb-panda-dynamic/src/test/resources/samples/taintSamples/SQLInjection2.ts create mode 100644 jacodb-panda-dynamic/src/test/resources/samples/taintSamples/SQLInjection3.json create mode 100644 jacodb-panda-dynamic/src/test/resources/samples/taintSamples/SQLInjection3.ts diff --git a/jacodb-analysis/src/main/kotlin/org/jacodb/analysis/util/PandaTraits.kt b/jacodb-analysis/src/main/kotlin/org/jacodb/analysis/util/PandaTraits.kt index 8c5c5c547..c309e052c 100644 --- a/jacodb-analysis/src/main/kotlin/org/jacodb/analysis/util/PandaTraits.kt +++ b/jacodb-analysis/src/main/kotlin/org/jacodb/analysis/util/PandaTraits.kt @@ -206,12 +206,7 @@ fun PandaValue.toPathOrNull(): AccessPath? = when (this) { } } - is PandaLoadedValue -> { - when (className) { - "console" -> instance.toPathOrNull() - else -> TODO("Not implemented yet") - } - } + is PandaLoadedValue -> instance.toPathOrNull() else -> null } diff --git a/jacodb-panda-dynamic/src/main/kotlin/org/jacodb/panda/dynamic/parser/IRParser.kt b/jacodb-panda-dynamic/src/main/kotlin/org/jacodb/panda/dynamic/parser/IRParser.kt index 812e81b1b..06754f275 100644 --- a/jacodb-panda-dynamic/src/main/kotlin/org/jacodb/panda/dynamic/parser/IRParser.kt +++ b/jacodb-panda-dynamic/src/main/kotlin/org/jacodb/panda/dynamic/parser/IRParser.kt @@ -834,6 +834,11 @@ class IRParser( handle(todoExpr) } + "Intrinsic.getmodulenamespace" -> { + val todoExpr = TODOExpr(opcode, inputs) // TODO + handle(todoExpr) + } + "Intrinsic.asyncfunctionenter" -> { val todoExpr = TODOExpr(opcode, inputs) // TODO handle(todoExpr) diff --git a/jacodb-panda-dynamic/src/test/kotlin/analysis/TaintSamples.kt b/jacodb-panda-dynamic/src/test/kotlin/analysis/TaintSamples.kt index f1f41791a..a391f3aff 100644 --- a/jacodb-panda-dynamic/src/test/kotlin/analysis/TaintSamples.kt +++ b/jacodb-panda-dynamic/src/test/kotlin/analysis/TaintSamples.kt @@ -35,9 +35,6 @@ import org.jacodb.panda.taint.UntrustedLoopBoundSinkCheck import org.jacodb.panda.taint.UntrustedArraySizeSinkCheck import org.jacodb.panda.taint.UntrustedIndexArrayAccessSinkCheck - -private val logger = mu.KotlinLogging.logger {} - class TaintSamples { private fun loadProjectForSample(programName: String): PandaProject { val parser = loadIr("/samples/${programName}.json") @@ -248,11 +245,15 @@ class TaintSamples { @Nested inner class SQLInjectionTest { - private val project: PandaProject = loadProjectForSample("taintSamples/SQLInjection") - private val fileTaintAnalyzer = TaintAnalyzer(project) + private fun getTaintAnalyserByProgramName(programName: String = "taintSamples/SQLInjection"): TaintAnalyzer { + val project: PandaProject = loadProjectForSample(programName) + val fileTaintAnalyzer = TaintAnalyzer(project) + return fileTaintAnalyzer + } @Test fun `counterexample - sql injection that lead to dropping table`() { + val fileTaintAnalyzer = getTaintAnalyserByProgramName() val sinkResults = fileTaintAnalyzer.analyseOneCase( CaseTaintConfig( sourceMethodConfigs = listOf(SourceMethodConfig("getUserName")), @@ -265,6 +266,40 @@ class TaintSamples { ) assert(sinkResults.size == 1) } + + @Test + fun `counterexample - more realistic sql injection`() { + val fileTaintAnalyzer = getTaintAnalyserByProgramName("taintSamples/SQLInjection2") + val sinkResults = fileTaintAnalyzer.analyseOneCase( + CaseTaintConfig( + sourceMethodConfigs = listOf(SourceMethodConfig("getUser")), + sinkMethodConfigs = listOf( + SinkMethodConfig( + methodName = "query", + position = Argument(1) + ) + ), + ) + ) + assert(sinkResults.size == 1) + } + + @Test + fun `counterexample - most production-like sql injection`() { + val fileTaintAnalyzer = getTaintAnalyserByProgramName("taintSamples/SQLInjection3") + val sinkResults = fileTaintAnalyzer.analyseOneCase( + CaseTaintConfig( + sourceMethodConfigs = listOf(SourceMethodConfig("getUser")), + sinkMethodConfigs = listOf( + SinkMethodConfig( + methodName = "query", + position = Argument(1) + ) + ), + ) + ) + assert(sinkResults.size == 1) + } } @Nested diff --git a/jacodb-panda-dynamic/src/test/resources/samples/taintSamples/SQLInjection2.json b/jacodb-panda-dynamic/src/test/resources/samples/taintSamples/SQLInjection2.json new file mode 100644 index 000000000..b0c39cc79 --- /dev/null +++ b/jacodb-panda-dynamic/src/test/resources/samples/taintSamples/SQLInjection2.json @@ -0,0 +1,3060 @@ +{ + "classes": [ + { + "name": "Connection", + "properties": [ + { + "method": { + "accessFlags": 8, + "basicBlocks": [ + { + "id": 1, + "insts": [ + { + "id": "v0", + "index": 0, + "opcode": "Parameter", + "type": "any" + }, + { + "id": "v1", + "index": 1, + "opcode": "Parameter", + "type": "any" + }, + { + "id": "v2", + "index": 2, + "opcode": "Parameter", + "type": "any" + }, + { + "id": "v3", + "index": 3, + "opcode": "Parameter", + "type": "any" + } + ], + "isCatchBegin": false, + "isTryBegin": false, + "isTryEnd": false, + "successors": [ + 0 + ] + }, + { + "id": 0, + "insts": [ + { + "id": "v5", + "opcode": "SaveState", + "type": "void", + "users": [ + "v4" + ] + }, + { + "id": "v4", + "inputs": [ + "v5" + ], + "intrinsic_id": "Intrinsic.ldundefined", + "opcode": "Intrinsic", + "type": "any" + }, + { + "id": "v7", + "opcode": "SaveState", + "type": "void", + "users": [ + "v6" + ] + }, + { + "id": "v6", + "inputs": [ + "v7" + ], + "intrinsic_id": "Intrinsic.returnundefined", + "opcode": "Intrinsic", + "type": "void" + } + ], + "isCatchBegin": false, + "isTryBegin": false, + "isTryEnd": false, + "predecessors": [ + 1 + ], + "successors": [ + 2 + ] + }, + { + "id": 2, + "isCatchBegin": false, + "isTryBegin": false, + "isTryEnd": false, + "predecessors": [ + 0 + ] + } + ], + "name": "connect", + "returnType": "any", + "signature": ".connect" + }, + "name": "connect" + } + ] + }, + { + "name": "app", + "properties": [ + { + "method": { + "accessFlags": 8, + "basicBlocks": [ + { + "id": 1, + "insts": [ + { + "id": "v0", + "index": 0, + "opcode": "Parameter", + "type": "any" + }, + { + "id": "v1", + "index": 1, + "opcode": "Parameter", + "type": "any" + }, + { + "id": "v2", + "index": 2, + "opcode": "Parameter", + "type": "any" + }, + { + "id": "v3", + "index": 3, + "opcode": "Parameter", + "type": "any" + }, + { + "id": "v4", + "index": 4, + "opcode": "Parameter", + "type": "any" + } + ], + "isCatchBegin": false, + "isTryBegin": false, + "isTryEnd": false, + "successors": [ + 0 + ] + }, + { + "id": 0, + "insts": [ + { + "id": "v6", + "opcode": "SaveState", + "type": "void", + "users": [ + "v5" + ] + }, + { + "id": "v5", + "inputs": [ + "v6" + ], + "intrinsic_id": "Intrinsic.ldundefined", + "opcode": "Intrinsic", + "type": "any" + }, + { + "id": "v8", + "opcode": "SaveState", + "type": "void", + "users": [ + "v7" + ] + }, + { + "id": "v7", + "inputs": [ + "v8" + ], + "intrinsic_id": "Intrinsic.returnundefined", + "opcode": "Intrinsic", + "type": "void" + } + ], + "isCatchBegin": false, + "isTryBegin": false, + "isTryEnd": false, + "predecessors": [ + 1 + ], + "successors": [ + 2 + ] + }, + { + "id": 2, + "isCatchBegin": false, + "isTryBegin": false, + "isTryEnd": false, + "predecessors": [ + 0 + ] + } + ], + "name": "#15347021998566069348#connect", + "returnType": "any", + "signature": ".#15347021998566069348#connect" + }, + "name": "connect" + }, + { + "method": { + "accessFlags": 8, + "basicBlocks": [ + { + "id": 1, + "insts": [ + { + "id": "v0", + "index": 0, + "opcode": "Parameter", + "type": "any" + }, + { + "id": "v1", + "index": 1, + "opcode": "Parameter", + "type": "any" + }, + { + "id": "v2", + "index": 2, + "opcode": "Parameter", + "type": "any" + }, + { + "id": "v3", + "index": 3, + "opcode": "Parameter", + "type": "any" + }, + { + "id": "v4", + "index": 4, + "opcode": "Parameter", + "type": "any" + } + ], + "isCatchBegin": false, + "isTryBegin": false, + "isTryEnd": false, + "successors": [ + 0 + ] + }, + { + "id": 0, + "insts": [ + { + "id": "v6", + "opcode": "SaveState", + "type": "void", + "users": [ + "v5" + ] + }, + { + "id": "v5", + "inputs": [ + "v6" + ], + "intrinsic_id": "Intrinsic.ldundefined", + "opcode": "Intrinsic", + "type": "any" + }, + { + "id": "v8", + "opcode": "SaveState", + "type": "void", + "users": [ + "v7" + ] + }, + { + "id": "v7", + "inputs": [ + "v8" + ], + "intrinsic_id": "Intrinsic.returnundefined", + "opcode": "Intrinsic", + "type": "void" + } + ], + "isCatchBegin": false, + "isTryBegin": false, + "isTryEnd": false, + "predecessors": [ + 1 + ], + "successors": [ + 2 + ] + }, + { + "id": 2, + "isCatchBegin": false, + "isTryBegin": false, + "isTryEnd": false, + "predecessors": [ + 0 + ] + } + ], + "name": "listen", + "returnType": "any", + "signature": ".listen" + }, + "name": "listen" + } + ] + }, + { + "name": "GLOBAL", + "properties": [ + { + "method": { + "accessFlags": 264, + "basicBlocks": [ + { + "id": 1, + "insts": [ + { + "id": "v0", + "index": 0, + "opcode": "Parameter", + "type": "any" + }, + { + "id": "v1", + "index": 1, + "opcode": "Parameter", + "type": "any" + }, + { + "id": "v2", + "index": 2, + "opcode": "Parameter", + "type": "any", + "users": [ + "v3" + ] + } + ], + "isCatchBegin": false, + "isTryBegin": false, + "isTryEnd": false, + "successors": [ + 0 + ] + }, + { + "id": 0, + "insts": [ + { + "id": "v4", + "opcode": "SaveState", + "type": "void", + "users": [ + "v3" + ] + }, + { + "id": "v3", + "inputs": [ + "v2", + "v4" + ], + "intrinsic_id": "Intrinsic.return", + "opcode": "Intrinsic", + "type": "void" + } + ], + "isCatchBegin": false, + "isTryBegin": false, + "isTryEnd": false, + "predecessors": [ + 1 + ], + "successors": [ + 2 + ] + }, + { + "id": 2, + "isCatchBegin": false, + "isTryBegin": false, + "isTryEnd": false, + "predecessors": [ + 0 + ] + } + ], + "name": "app", + "returnType": "any", + "signature": ".app" + }, + "name": "app" + }, + { + "method": { + "accessFlags": 8, + "basicBlocks": [ + { + "id": 1, + "insts": [ + { + "id": "v0", + "index": 0, + "opcode": "Parameter", + "type": "any" + }, + { + "id": "v1", + "index": 1, + "opcode": "Parameter", + "type": "any" + }, + { + "id": "v2", + "index": 2, + "opcode": "Parameter", + "type": "any", + "users": [ + "v4" + ] + }, + { + "id": "v3", + "index": 3, + "opcode": "Parameter", + "type": "any" + } + ], + "isCatchBegin": false, + "isTryBegin": false, + "isTryEnd": false, + "successors": [ + 0 + ] + }, + { + "id": 0, + "insts": [ + { + "id": "v5", + "opcode": "SaveState", + "type": "void", + "users": [ + "v4" + ] + }, + { + "id": "v4", + "inputs": [ + "v2", + "v5" + ], + "intrinsic_id": "Intrinsic.return", + "opcode": "Intrinsic", + "type": "void" + } + ], + "isCatchBegin": false, + "isTryBegin": false, + "isTryEnd": false, + "predecessors": [ + 1 + ], + "successors": [ + 2 + ] + }, + { + "id": 2, + "isCatchBegin": false, + "isTryBegin": false, + "isTryEnd": false, + "predecessors": [ + 0 + ] + } + ], + "name": "Connection", + "returnType": "any", + "signature": ".Connection" + }, + "name": "Connection" + }, + { + "method": { + "accessFlags": 264, + "basicBlocks": [ + { + "id": 1, + "insts": [ + { + "id": "v0", + "index": 0, + "opcode": "Parameter", + "type": "any" + }, + { + "id": "v1", + "index": 1, + "opcode": "Parameter", + "type": "any", + "users": [ + "v5" + ] + }, + { + "id": "v2", + "index": 2, + "opcode": "Parameter", + "type": "any", + "users": [ + "v7" + ] + }, + { + "id": "v25", + "opcode": "Constant", + "type": "i32", + "users": [ + "v26" + ], + "value": 3000 + } + ], + "isCatchBegin": false, + "isTryBegin": false, + "isTryEnd": false, + "successors": [ + 0 + ] + }, + { + "id": 0, + "insts": [ + { + "id": "v4", + "opcode": "SaveState", + "type": "void", + "users": [ + "v3" + ] + }, + { + "id": "v3", + "imms": [ + 4 + ], + "inputs": [ + "v4" + ], + "intrinsic_id": "Intrinsic.newlexenv", + "opcode": "Intrinsic", + "type": "any" + }, + { + "id": "v6", + "opcode": "SaveState", + "type": "void", + "users": [ + "v5" + ] + }, + { + "id": "v5", + "imms": [ + 0, + 2 + ], + "inputs": [ + "v1", + "v6" + ], + "intrinsic_id": "Intrinsic.stlexvar", + "lexenv": 0, + "lexvar": 2, + "opcode": "Intrinsic", + "type": "void" + }, + { + "id": "v8", + "opcode": "SaveState", + "type": "void", + "users": [ + "v7" + ] + }, + { + "id": "v7", + "imms": [ + 0, + 3 + ], + "inputs": [ + "v2", + "v8" + ], + "intrinsic_id": "Intrinsic.stlexvar", + "lexenv": 0, + "lexvar": 3, + "opcode": "Intrinsic", + "type": "void" + }, + { + "id": "v10", + "opcode": "SaveState", + "type": "void", + "users": [ + "v9" + ] + }, + { + "id": "v9", + "inputs": [ + "v10" + ], + "intrinsic_id": "Intrinsic.ldhole", + "opcode": "Intrinsic", + "type": "any", + "users": [ + "v11" + ] + }, + { + "id": "v12", + "opcode": "SaveState", + "type": "void", + "users": [ + "v11" + ] + }, + { + "constructorName": ".Connection", + "id": "v11", + "imms": [ + 0, + 925, + 1272, + 1 + ], + "inputs": [ + "v9", + "v12" + ], + "intrinsic_id": "Intrinsic.defineclasswithbuffer", + "opcode": "Intrinsic", + "type": "any", + "users": [ + "v15", + "v13" + ] + }, + { + "id": "v14", + "opcode": "SaveState", + "type": "void", + "users": [ + "v13" + ] + }, + { + "id": "v13", + "imms": [ + 1, + 675 + ], + "inputs": [ + "v11", + "v14" + ], + "intrinsic_id": "Intrinsic.ldobjbyname", + "opcode": "Intrinsic", + "string_data": "prototype", + "type": "any" + }, + { + "id": "v16", + "opcode": "SaveState", + "type": "void", + "users": [ + "v15" + ] + }, + { + "id": "v15", + "imms": [ + 3, + 449 + ], + "inputs": [ + "v11", + "v16" + ], + "intrinsic_id": "Intrinsic.sttoglobalrecord", + "opcode": "Intrinsic", + "string_data": "Connection", + "type": "void" + }, + { + "id": "v18", + "opcode": "SaveState", + "type": "void", + "users": [ + "v17" + ] + }, + { + "id": "v17", + "inputs": [ + "v18" + ], + "intrinsic_id": "Intrinsic.ldhole", + "opcode": "Intrinsic", + "type": "any", + "users": [ + "v19" + ] + }, + { + "id": "v20", + "opcode": "SaveState", + "type": "void", + "users": [ + "v19" + ] + }, + { + "constructorName": ".app", + "id": "v19", + "imms": [ + 4, + 843, + 1294, + 0 + ], + "inputs": [ + "v17", + "v20" + ], + "intrinsic_id": "Intrinsic.defineclasswithbuffer", + "opcode": "Intrinsic", + "type": "any", + "users": [ + "v23", + "v21" + ] + }, + { + "id": "v22", + "opcode": "SaveState", + "type": "void", + "users": [ + "v21" + ] + }, + { + "id": "v21", + "imms": [ + 5, + 675 + ], + "inputs": [ + "v19", + "v22" + ], + "intrinsic_id": "Intrinsic.ldobjbyname", + "opcode": "Intrinsic", + "string_data": "prototype", + "type": "any" + }, + { + "id": "v24", + "opcode": "SaveState", + "type": "void", + "users": [ + "v23" + ] + }, + { + "id": "v23", + "imms": [ + 7, + 594 + ], + "inputs": [ + "v19", + "v24" + ], + "intrinsic_id": "Intrinsic.sttoglobalrecord", + "opcode": "Intrinsic", + "string_data": "app", + "type": "void" + }, + { + "id": "v27", + "opcode": "SaveState", + "type": "void", + "users": [ + "v26" + ] + }, + { + "id": "v26", + "imms": [ + 8, + 669 + ], + "inputs": [ + "v25", + "v27" + ], + "intrinsic_id": "Intrinsic.stconsttoglobalrecord", + "opcode": "Intrinsic", + "string_data": "port", + "type": "void" + }, + { + "id": "v29", + "opcode": "SaveState", + "type": "void", + "users": [ + "v28" + ] + }, + { + "id": "v28", + "imms": [ + 9, + 449 + ], + "inputs": [ + "v29" + ], + "intrinsic_id": "Intrinsic.tryldglobalbyname", + "opcode": "Intrinsic", + "string_data": "Connection", + "type": "any", + "users": [ + "v32" + ] + }, + { + "id": "v31", + "opcode": "SaveState", + "type": "void", + "users": [ + "v30" + ] + }, + { + "id": "v30", + "imms": [ + 10, + 1329 + ], + "inputs": [ + "v31" + ], + "intrinsic_id": "Intrinsic.createobjectwithbuffer", + "opcode": "Intrinsic", + "string_data": "", + "type": "any", + "users": [ + "v32" + ] + }, + { + "id": "v33", + "opcode": "SaveState", + "type": "void", + "users": [ + "v32" + ] + }, + { + "id": "v32", + "imms": [ + 11 + ], + "inputs": [ + "v30", + "v28", + "v33" + ], + "intrinsic_id": "Intrinsic.callarg1", + "opcode": "Intrinsic", + "type": "any", + "users": [ + "v34" + ] + }, + { + "id": "v35", + "opcode": "SaveState", + "type": "void", + "users": [ + "v34" + ] + }, + { + "id": "v34", + "imms": [ + 13, + 608 + ], + "inputs": [ + "v32", + "v35" + ], + "intrinsic_id": "Intrinsic.stconsttoglobalrecord", + "opcode": "Intrinsic", + "string_data": "connection", + "type": "void" + }, + { + "id": "v37", + "opcode": "SaveState", + "type": "void", + "users": [ + "v36" + ] + }, + { + "id": "v36", + "imms": [ + 14, + 608 + ], + "inputs": [ + "v37" + ], + "intrinsic_id": "Intrinsic.tryldglobalbyname", + "opcode": "Intrinsic", + "string_data": "connection", + "type": "any", + "users": [ + "v42", + "v38" + ] + }, + { + "id": "v39", + "opcode": "SaveState", + "type": "void", + "users": [ + "v38" + ] + }, + { + "id": "v38", + "imms": [ + 15, + 599 + ], + "inputs": [ + "v36", + "v39" + ], + "intrinsic_id": "Intrinsic.ldobjbyname", + "opcode": "Intrinsic", + "string_data": "connect", + "type": "any", + "users": [ + "v42" + ] + }, + { + "id": "v41", + "opcode": "SaveState", + "type": "void", + "users": [ + "v40" + ] + }, + { + "functionName": ".#3048179105868511693#", + "id": "v40", + "imms": [ + 17, + 980, + 1 + ], + "inputs": [ + "v41" + ], + "intrinsic_id": "Intrinsic.definefunc", + "opcode": "Intrinsic", + "type": "any", + "users": [ + "v42" + ] + }, + { + "id": "v43", + "opcode": "SaveState", + "type": "void", + "users": [ + "v42" + ] + }, + { + "id": "v42", + "imms": [ + 18 + ], + "inputs": [ + "v36", + "v40", + "v38", + "v43" + ], + "intrinsic_id": "Intrinsic.callthis1", + "opcode": "Intrinsic", + "type": "any" + }, + { + "id": "v45", + "opcode": "SaveState", + "type": "void", + "users": [ + "v44" + ] + }, + { + "id": "v44", + "imms": [ + 20, + 594 + ], + "inputs": [ + "v45" + ], + "intrinsic_id": "Intrinsic.tryldglobalbyname", + "opcode": "Intrinsic", + "string_data": "app", + "type": "any", + "users": [ + "v53", + "v46" + ] + }, + { + "id": "v47", + "opcode": "SaveState", + "type": "void", + "users": [ + "v46" + ] + }, + { + "id": "v46", + "imms": [ + 21, + 636 + ], + "inputs": [ + "v44", + "v47" + ], + "intrinsic_id": "Intrinsic.ldobjbyname", + "opcode": "Intrinsic", + "string_data": "get", + "type": "any", + "users": [ + "v53" + ] + }, + { + "id": "v48", + "opcode": "SaveState", + "type": "void", + "users": [ + "v49" + ] + }, + { + "id": "v49", + "inputs": [ + "v48" + ], + "opcode": "LoadString", + "string": "/user", + "stringOffset": 419, + "type": "ref", + "users": [ + "v50" + ] + }, + { + "id": "v50", + "inputs": [ + "v49" + ], + "opcode": "CastValueToAnyType", + "type": "any", + "users": [ + "v53" + ] + }, + { + "id": "v52", + "opcode": "SaveState", + "type": "void", + "users": [ + "v51" + ] + }, + { + "functionName": ".#13757513383743496318#", + "id": "v51", + "imms": [ + 23, + 1036, + 2 + ], + "inputs": [ + "v52" + ], + "intrinsic_id": "Intrinsic.definefunc", + "opcode": "Intrinsic", + "type": "any", + "users": [ + "v53" + ] + }, + { + "id": "v54", + "opcode": "SaveState", + "type": "void", + "users": [ + "v53" + ] + }, + { + "id": "v53", + "imms": [ + 24 + ], + "inputs": [ + "v44", + "v50", + "v51", + "v46", + "v54" + ], + "intrinsic_id": "Intrinsic.callthis2", + "opcode": "Intrinsic", + "type": "any" + }, + { + "id": "v56", + "opcode": "SaveState", + "type": "void", + "users": [ + "v55" + ] + }, + { + "id": "v55", + "imms": [ + 26, + 594 + ], + "inputs": [ + "v56" + ], + "intrinsic_id": "Intrinsic.tryldglobalbyname", + "opcode": "Intrinsic", + "string_data": "app", + "type": "any", + "users": [ + "v63", + "v57" + ] + }, + { + "id": "v58", + "opcode": "SaveState", + "type": "void", + "users": [ + "v57" + ] + }, + { + "id": "v57", + "imms": [ + 27, + 656 + ], + "inputs": [ + "v55", + "v58" + ], + "intrinsic_id": "Intrinsic.ldobjbyname", + "opcode": "Intrinsic", + "string_data": "listen", + "type": "any", + "users": [ + "v63" + ] + }, + { + "id": "v60", + "opcode": "SaveState", + "type": "void", + "users": [ + "v59" + ] + }, + { + "id": "v59", + "imms": [ + 29, + 669 + ], + "inputs": [ + "v60" + ], + "intrinsic_id": "Intrinsic.tryldglobalbyname", + "opcode": "Intrinsic", + "string_data": "port", + "type": "any", + "users": [ + "v63" + ] + }, + { + "id": "v62", + "opcode": "SaveState", + "type": "void", + "users": [ + "v61" + ] + }, + { + "functionName": ".#5294593874550887413#", + "id": "v61", + "imms": [ + 30, + 1008, + 0 + ], + "inputs": [ + "v62" + ], + "intrinsic_id": "Intrinsic.definefunc", + "opcode": "Intrinsic", + "type": "any", + "users": [ + "v63" + ] + }, + { + "id": "v64", + "opcode": "SaveState", + "type": "void", + "users": [ + "v63" + ] + }, + { + "id": "v63", + "imms": [ + 31 + ], + "inputs": [ + "v55", + "v59", + "v61", + "v57", + "v64" + ], + "intrinsic_id": "Intrinsic.callthis2", + "opcode": "Intrinsic", + "type": "any" + }, + { + "id": "v66", + "opcode": "SaveState", + "type": "void", + "users": [ + "v65" + ] + }, + { + "id": "v65", + "inputs": [ + "v66" + ], + "intrinsic_id": "Intrinsic.ldundefined", + "opcode": "Intrinsic", + "type": "any" + }, + { + "id": "v68", + "opcode": "SaveState", + "type": "void", + "users": [ + "v67" + ] + }, + { + "id": "v67", + "inputs": [ + "v68" + ], + "intrinsic_id": "Intrinsic.returnundefined", + "opcode": "Intrinsic", + "type": "void" + } + ], + "isCatchBegin": false, + "isTryBegin": false, + "isTryEnd": false, + "predecessors": [ + 1 + ], + "successors": [ + 2 + ] + }, + { + "id": 2, + "isCatchBegin": false, + "isTryBegin": false, + "isTryEnd": false, + "predecessors": [ + 0 + ] + } + ], + "name": "func_main_0", + "returnType": "any", + "signature": ".func_main_0" + }, + "name": "func_main_0" + }, + { + "method": { + "accessFlags": 520, + "basicBlocks": [ + { + "id": 3, + "insts": [ + { + "id": "v0", + "index": 0, + "opcode": "Parameter", + "type": "any" + }, + { + "id": "v1", + "index": 1, + "opcode": "Parameter", + "type": "any" + }, + { + "id": "v2", + "index": 2, + "opcode": "Parameter", + "type": "any" + }, + { + "id": "v3", + "index": 3, + "opcode": "Parameter", + "type": "any", + "users": [ + "v16", + "v4" + ] + }, + { + "id": "v7", + "opcode": "Constant", + "type": "i64", + "users": [ + "v6" + ], + "value": 0 + } + ], + "isCatchBegin": false, + "isTryBegin": false, + "isTryEnd": false, + "successors": [ + 0 + ] + }, + { + "id": 0, + "insts": [ + { + "id": "v5", + "opcode": "SaveState", + "type": "void", + "users": [ + "v4" + ] + }, + { + "id": "v4", + "inputs": [ + "v3", + "v5" + ], + "intrinsic_id": "Intrinsic.isfalse", + "opcode": "Intrinsic", + "type": "any", + "users": [ + "v6" + ] + }, + { + "id": "v6", + "inputs": [ + "v4", + "v7" + ], + "opcode": "Compare", + "operandsType": "any", + "operator": "NE", + "type": "u1", + "users": [ + "v8" + ] + }, + { + "id": "v8", + "immediate": 0, + "inputs": [ + "v6" + ], + "opcode": "IfImm", + "operandsType": "u1", + "operator": "NE", + "type": "void" + } + ], + "isCatchBegin": false, + "isTryBegin": false, + "isTryEnd": false, + "predecessors": [ + 3 + ], + "successors": [ + 1, + 2 + ] + }, + { + "id": 2, + "insts": [ + { + "id": "v10", + "opcode": "SaveState", + "type": "void", + "users": [ + "v9" + ] + }, + { + "id": "v9", + "imms": [ + 0, + 620 + ], + "inputs": [ + "v10" + ], + "intrinsic_id": "Intrinsic.tryldglobalbyname", + "opcode": "Intrinsic", + "string_data": "console", + "type": "any", + "users": [ + "v16", + "v11" + ] + }, + { + "id": "v12", + "opcode": "SaveState", + "type": "void", + "users": [ + "v11" + ] + }, + { + "id": "v11", + "imms": [ + 1, + 629 + ], + "inputs": [ + "v9", + "v12" + ], + "intrinsic_id": "Intrinsic.ldobjbyname", + "opcode": "Intrinsic", + "string_data": "error", + "type": "any", + "users": [ + "v16" + ] + }, + { + "id": "v13", + "opcode": "SaveState", + "type": "void", + "users": [ + "v14" + ] + }, + { + "id": "v14", + "inputs": [ + "v13" + ], + "opcode": "LoadString", + "string": "Error connecting to database:", + "stringOffset": 483, + "type": "ref", + "users": [ + "v15" + ] + }, + { + "id": "v15", + "inputs": [ + "v14" + ], + "opcode": "CastValueToAnyType", + "type": "any", + "users": [ + "v16" + ] + }, + { + "id": "v17", + "opcode": "SaveState", + "type": "void", + "users": [ + "v16" + ] + }, + { + "id": "v16", + "imms": [ + 3 + ], + "inputs": [ + "v9", + "v15", + "v3", + "v11", + "v17" + ], + "intrinsic_id": "Intrinsic.callthis2", + "opcode": "Intrinsic", + "type": "any" + }, + { + "id": "v19", + "opcode": "SaveState", + "type": "void", + "users": [ + "v18" + ] + }, + { + "id": "v18", + "inputs": [ + "v19" + ], + "intrinsic_id": "Intrinsic.ldundefined", + "opcode": "Intrinsic", + "type": "any" + }, + { + "id": "v21", + "opcode": "SaveState", + "type": "void", + "users": [ + "v20" + ] + }, + { + "id": "v20", + "inputs": [ + "v21" + ], + "intrinsic_id": "Intrinsic.ldundefined", + "opcode": "Intrinsic", + "type": "any" + }, + { + "id": "v23", + "opcode": "SaveState", + "type": "void", + "users": [ + "v22" + ] + }, + { + "id": "v22", + "inputs": [ + "v23" + ], + "intrinsic_id": "Intrinsic.returnundefined", + "opcode": "Intrinsic", + "type": "void" + } + ], + "isCatchBegin": false, + "isTryBegin": false, + "isTryEnd": false, + "predecessors": [ + 0 + ], + "successors": [ + 4 + ] + }, + { + "id": 1, + "insts": [ + { + "id": "v25", + "opcode": "SaveState", + "type": "void", + "users": [ + "v24" + ] + }, + { + "id": "v24", + "imms": [ + 5, + 620 + ], + "inputs": [ + "v25" + ], + "intrinsic_id": "Intrinsic.tryldglobalbyname", + "opcode": "Intrinsic", + "string_data": "console", + "type": "any", + "users": [ + "v31", + "v26" + ] + }, + { + "id": "v27", + "opcode": "SaveState", + "type": "void", + "users": [ + "v26" + ] + }, + { + "id": "v26", + "imms": [ + 6, + 664 + ], + "inputs": [ + "v24", + "v27" + ], + "intrinsic_id": "Intrinsic.ldobjbyname", + "opcode": "Intrinsic", + "string_data": "log", + "type": "any", + "users": [ + "v31" + ] + }, + { + "id": "v28", + "opcode": "SaveState", + "type": "void", + "users": [ + "v29" + ] + }, + { + "id": "v29", + "inputs": [ + "v28" + ], + "opcode": "LoadString", + "string": "Connected to database", + "stringOffset": 426, + "type": "ref", + "users": [ + "v30" + ] + }, + { + "id": "v30", + "inputs": [ + "v29" + ], + "opcode": "CastValueToAnyType", + "type": "any", + "users": [ + "v31" + ] + }, + { + "id": "v32", + "opcode": "SaveState", + "type": "void", + "users": [ + "v31" + ] + }, + { + "id": "v31", + "imms": [ + 8 + ], + "inputs": [ + "v24", + "v30", + "v26", + "v32" + ], + "intrinsic_id": "Intrinsic.callthis1", + "opcode": "Intrinsic", + "type": "any" + }, + { + "id": "v34", + "opcode": "SaveState", + "type": "void", + "users": [ + "v33" + ] + }, + { + "id": "v33", + "inputs": [ + "v34" + ], + "intrinsic_id": "Intrinsic.ldundefined", + "opcode": "Intrinsic", + "type": "any" + }, + { + "id": "v36", + "opcode": "SaveState", + "type": "void", + "users": [ + "v35" + ] + }, + { + "id": "v35", + "inputs": [ + "v36" + ], + "intrinsic_id": "Intrinsic.returnundefined", + "opcode": "Intrinsic", + "type": "void" + } + ], + "isCatchBegin": false, + "isTryBegin": false, + "isTryEnd": false, + "predecessors": [ + 0 + ], + "successors": [ + 4 + ] + }, + { + "id": 4, + "isCatchBegin": false, + "isTryBegin": false, + "isTryEnd": false, + "predecessors": [ + 2, + 1 + ] + } + ], + "name": "#3048179105868511693#", + "returnType": "any", + "signature": ".#3048179105868511693#" + }, + "name": "" + }, + { + "method": { + "accessFlags": 520, + "basicBlocks": [ + { + "id": 1, + "insts": [ + { + "id": "v0", + "index": 0, + "opcode": "Parameter", + "type": "any" + }, + { + "id": "v1", + "index": 1, + "opcode": "Parameter", + "type": "any" + }, + { + "id": "v2", + "index": 2, + "opcode": "Parameter", + "type": "any" + } + ], + "isCatchBegin": false, + "isTryBegin": false, + "isTryEnd": false, + "successors": [ + 0 + ] + }, + { + "id": 0, + "insts": [ + { + "id": "v4", + "opcode": "SaveState", + "type": "void", + "users": [ + "v3" + ] + }, + { + "id": "v3", + "imms": [ + 0, + 620 + ], + "inputs": [ + "v4" + ], + "intrinsic_id": "Intrinsic.tryldglobalbyname", + "opcode": "Intrinsic", + "string_data": "console", + "type": "any", + "users": [ + "v19", + "v5" + ] + }, + { + "id": "v6", + "opcode": "SaveState", + "type": "void", + "users": [ + "v5" + ] + }, + { + "id": "v5", + "imms": [ + 1, + 664 + ], + "inputs": [ + "v3", + "v6" + ], + "intrinsic_id": "Intrinsic.ldobjbyname", + "opcode": "Intrinsic", + "string_data": "log", + "type": "any", + "users": [ + "v19" + ] + }, + { + "id": "v7", + "opcode": "SaveState", + "type": "void", + "users": [ + "v8" + ] + }, + { + "id": "v8", + "inputs": [ + "v7" + ], + "opcode": "LoadString", + "string": "Server is running on http://localhost:", + "stringOffset": 554, + "type": "ref", + "users": [ + "v9" + ] + }, + { + "id": "v9", + "inputs": [ + "v8" + ], + "opcode": "CastValueToAnyType", + "type": "any", + "users": [ + "v12" + ] + }, + { + "id": "v11", + "opcode": "SaveState", + "type": "void", + "users": [ + "v10" + ] + }, + { + "id": "v10", + "imms": [ + 3, + 669 + ], + "inputs": [ + "v11" + ], + "intrinsic_id": "Intrinsic.tryldglobalbyname", + "opcode": "Intrinsic", + "string_data": "port", + "type": "any", + "users": [ + "v12" + ] + }, + { + "id": "v13", + "opcode": "SaveState", + "type": "void", + "users": [ + "v12" + ] + }, + { + "id": "v12", + "imms": [ + 4 + ], + "inputs": [ + "v9", + "v10", + "v13" + ], + "intrinsic_id": "Intrinsic.add2", + "opcode": "Intrinsic", + "type": "any", + "users": [ + "v17" + ] + }, + { + "id": "v14", + "opcode": "SaveState", + "type": "void", + "users": [ + "v15" + ] + }, + { + "id": "v15", + "inputs": [ + "v14" + ], + "opcode": "LoadString", + "string": "", + "stringOffset": 297, + "type": "ref", + "users": [ + "v16" + ] + }, + { + "id": "v16", + "inputs": [ + "v15" + ], + "opcode": "CastValueToAnyType", + "type": "any", + "users": [ + "v17" + ] + }, + { + "id": "v18", + "opcode": "SaveState", + "type": "void", + "users": [ + "v17" + ] + }, + { + "id": "v17", + "imms": [ + 5 + ], + "inputs": [ + "v12", + "v16", + "v18" + ], + "intrinsic_id": "Intrinsic.add2", + "opcode": "Intrinsic", + "type": "any", + "users": [ + "v19" + ] + }, + { + "id": "v20", + "opcode": "SaveState", + "type": "void", + "users": [ + "v19" + ] + }, + { + "id": "v19", + "imms": [ + 6 + ], + "inputs": [ + "v3", + "v17", + "v5", + "v20" + ], + "intrinsic_id": "Intrinsic.callthis1", + "opcode": "Intrinsic", + "type": "any" + }, + { + "id": "v22", + "opcode": "SaveState", + "type": "void", + "users": [ + "v21" + ] + }, + { + "id": "v21", + "inputs": [ + "v22" + ], + "intrinsic_id": "Intrinsic.ldundefined", + "opcode": "Intrinsic", + "type": "any" + }, + { + "id": "v24", + "opcode": "SaveState", + "type": "void", + "users": [ + "v23" + ] + }, + { + "id": "v23", + "inputs": [ + "v24" + ], + "intrinsic_id": "Intrinsic.returnundefined", + "opcode": "Intrinsic", + "type": "void" + } + ], + "isCatchBegin": false, + "isTryBegin": false, + "isTryEnd": false, + "predecessors": [ + 1 + ], + "successors": [ + 2 + ] + }, + { + "id": 2, + "isCatchBegin": false, + "isTryBegin": false, + "isTryEnd": false, + "predecessors": [ + 0 + ] + } + ], + "name": "#5294593874550887413#", + "returnType": "any", + "signature": ".#5294593874550887413#" + }, + "name": "" + }, + { + "method": { + "accessFlags": 520, + "basicBlocks": [ + { + "id": 1, + "insts": [ + { + "id": "v0", + "index": 0, + "opcode": "Parameter", + "type": "any" + }, + { + "id": "v1", + "index": 1, + "opcode": "Parameter", + "type": "any" + }, + { + "id": "v2", + "index": 2, + "opcode": "Parameter", + "type": "any" + }, + { + "id": "v3", + "index": 3, + "opcode": "Parameter", + "type": "any", + "users": [ + "v11", + "v9" + ] + }, + { + "id": "v4", + "index": 4, + "opcode": "Parameter", + "type": "any", + "users": [ + "v7" + ] + } + ], + "isCatchBegin": false, + "isTryBegin": false, + "isTryEnd": false, + "successors": [ + 0 + ] + }, + { + "id": 0, + "insts": [ + { + "id": "v6", + "opcode": "SaveState", + "type": "void", + "users": [ + "v5" + ] + }, + { + "id": "v5", + "imms": [ + 1 + ], + "inputs": [ + "v6" + ], + "intrinsic_id": "Intrinsic.newlexenv", + "opcode": "Intrinsic", + "type": "any" + }, + { + "id": "v8", + "opcode": "SaveState", + "type": "void", + "users": [ + "v7" + ] + }, + { + "id": "v7", + "imms": [ + 0, + 0 + ], + "inputs": [ + "v4", + "v8" + ], + "intrinsic_id": "Intrinsic.stlexvar", + "lexenv": 0, + "lexvar": 0, + "opcode": "Intrinsic", + "type": "void" + }, + { + "id": "v10", + "opcode": "SaveState", + "type": "void", + "users": [ + "v9" + ] + }, + { + "id": "v9", + "imms": [ + 0, + 641 + ], + "inputs": [ + "v3", + "v10" + ], + "intrinsic_id": "Intrinsic.ldobjbyname", + "opcode": "Intrinsic", + "string_data": "getUser", + "type": "any", + "users": [ + "v11" + ] + }, + { + "id": "v12", + "opcode": "SaveState", + "type": "void", + "users": [ + "v11" + ] + }, + { + "id": "v11", + "imms": [ + 2 + ], + "inputs": [ + "v3", + "v9", + "v12" + ], + "intrinsic_id": "Intrinsic.callthis0", + "opcode": "Intrinsic", + "type": "any", + "users": [ + "v16" + ] + }, + { + "id": "v13", + "opcode": "SaveState", + "type": "void", + "users": [ + "v14" + ] + }, + { + "id": "v14", + "inputs": [ + "v13" + ], + "opcode": "LoadString", + "string": "SELECT * FROM users WHERE username = \\'", + "stringOffset": 514, + "type": "ref", + "users": [ + "v15" + ] + }, + { + "id": "v15", + "inputs": [ + "v14" + ], + "opcode": "CastValueToAnyType", + "type": "any", + "users": [ + "v16" + ] + }, + { + "id": "v17", + "opcode": "SaveState", + "type": "void", + "users": [ + "v16" + ] + }, + { + "id": "v16", + "imms": [ + 4 + ], + "inputs": [ + "v15", + "v11", + "v17" + ], + "intrinsic_id": "Intrinsic.add2", + "opcode": "Intrinsic", + "type": "any", + "users": [ + "v21" + ] + }, + { + "id": "v18", + "opcode": "SaveState", + "type": "void", + "users": [ + "v19" + ] + }, + { + "id": "v19", + "inputs": [ + "v18" + ], + "opcode": "LoadString", + "string": "\\'", + "stringOffset": 299, + "type": "ref", + "users": [ + "v20" + ] + }, + { + "id": "v20", + "inputs": [ + "v19" + ], + "opcode": "CastValueToAnyType", + "type": "any", + "users": [ + "v21" + ] + }, + { + "id": "v22", + "opcode": "SaveState", + "type": "void", + "users": [ + "v21" + ] + }, + { + "id": "v21", + "imms": [ + 5 + ], + "inputs": [ + "v16", + "v20", + "v22" + ], + "intrinsic_id": "Intrinsic.add2", + "opcode": "Intrinsic", + "type": "any", + "users": [ + "v29" + ] + }, + { + "id": "v24", + "opcode": "SaveState", + "type": "void", + "users": [ + "v23" + ] + }, + { + "id": "v23", + "imms": [ + 6, + 608 + ], + "inputs": [ + "v24" + ], + "intrinsic_id": "Intrinsic.tryldglobalbyname", + "opcode": "Intrinsic", + "string_data": "connection", + "type": "any", + "users": [ + "v29", + "v25" + ] + }, + { + "id": "v26", + "opcode": "SaveState", + "type": "void", + "users": [ + "v25" + ] + }, + { + "id": "v25", + "imms": [ + 7, + 686 + ], + "inputs": [ + "v23", + "v26" + ], + "intrinsic_id": "Intrinsic.ldobjbyname", + "opcode": "Intrinsic", + "string_data": "query", + "type": "any", + "users": [ + "v29" + ] + }, + { + "id": "v28", + "opcode": "SaveState", + "type": "void", + "users": [ + "v27" + ] + }, + { + "functionName": ".#15727984211755898705#", + "id": "v27", + "imms": [ + 9, + 1064, + 2 + ], + "inputs": [ + "v28" + ], + "intrinsic_id": "Intrinsic.definefunc", + "opcode": "Intrinsic", + "type": "any", + "users": [ + "v29" + ] + }, + { + "id": "v30", + "opcode": "SaveState", + "type": "void", + "users": [ + "v29" + ] + }, + { + "id": "v29", + "imms": [ + 10 + ], + "inputs": [ + "v23", + "v21", + "v27", + "v25", + "v30" + ], + "intrinsic_id": "Intrinsic.callthis2", + "opcode": "Intrinsic", + "type": "any" + }, + { + "id": "v32", + "opcode": "SaveState", + "type": "void", + "users": [ + "v31" + ] + }, + { + "id": "v31", + "inputs": [ + "v32" + ], + "intrinsic_id": "Intrinsic.ldundefined", + "opcode": "Intrinsic", + "type": "any" + }, + { + "id": "v34", + "opcode": "SaveState", + "type": "void", + "users": [ + "v33" + ] + }, + { + "id": "v33", + "inputs": [ + "v34" + ], + "intrinsic_id": "Intrinsic.returnundefined", + "opcode": "Intrinsic", + "type": "void" + } + ], + "isCatchBegin": false, + "isTryBegin": false, + "isTryEnd": false, + "predecessors": [ + 1 + ], + "successors": [ + 2 + ] + }, + { + "id": 2, + "isCatchBegin": false, + "isTryBegin": false, + "isTryEnd": false, + "predecessors": [ + 0 + ] + } + ], + "name": "#13757513383743496318#", + "returnType": "any", + "signature": ".#13757513383743496318#" + }, + "name": "" + }, + { + "method": { + "accessFlags": 520, + "basicBlocks": [ + { + "id": 3, + "insts": [ + { + "id": "v0", + "index": 0, + "opcode": "Parameter", + "type": "any" + }, + { + "id": "v1", + "index": 1, + "opcode": "Parameter", + "type": "any" + }, + { + "id": "v2", + "index": 2, + "opcode": "Parameter", + "type": "any" + }, + { + "id": "v3", + "index": 3, + "opcode": "Parameter", + "type": "any", + "users": [ + "v5" + ] + }, + { + "id": "v4", + "index": 4, + "opcode": "Parameter", + "type": "any", + "users": [ + "v34" + ] + }, + { + "id": "v8", + "opcode": "Constant", + "type": "i64", + "users": [ + "v7" + ], + "value": 0 + }, + { + "id": "v14", + "opcode": "Constant", + "type": "i32", + "users": [ + "v15" + ], + "value": 500 + } + ], + "isCatchBegin": false, + "isTryBegin": false, + "isTryEnd": false, + "successors": [ + 0 + ] + }, + { + "id": 0, + "insts": [ + { + "id": "v6", + "opcode": "SaveState", + "type": "void", + "users": [ + "v5" + ] + }, + { + "id": "v5", + "inputs": [ + "v3", + "v6" + ], + "intrinsic_id": "Intrinsic.isfalse", + "opcode": "Intrinsic", + "type": "any", + "users": [ + "v7" + ] + }, + { + "id": "v7", + "inputs": [ + "v5", + "v8" + ], + "opcode": "Compare", + "operandsType": "any", + "operator": "NE", + "type": "u1", + "users": [ + "v9" + ] + }, + { + "id": "v9", + "immediate": 0, + "inputs": [ + "v7" + ], + "opcode": "IfImm", + "operandsType": "u1", + "operator": "NE", + "type": "void" + } + ], + "isCatchBegin": false, + "isTryBegin": false, + "isTryEnd": false, + "predecessors": [ + 3 + ], + "successors": [ + 1, + 2 + ] + }, + { + "id": 2, + "insts": [ + { + "id": "v11", + "opcode": "SaveState", + "type": "void", + "users": [ + "v10" + ] + }, + { + "id": "v10", + "imms": [ + 0, + 0 + ], + "inputs": [ + "v11" + ], + "intrinsic_id": "Intrinsic.ldlexvar", + "lexenv": 0, + "lexvar": 0, + "opcode": "Intrinsic", + "type": "any", + "users": [ + "v15", + "v12" + ] + }, + { + "id": "v13", + "opcode": "SaveState", + "type": "void", + "users": [ + "v12" + ] + }, + { + "id": "v12", + "imms": [ + 0, + 699 + ], + "inputs": [ + "v10", + "v13" + ], + "intrinsic_id": "Intrinsic.ldobjbyname", + "opcode": "Intrinsic", + "string_data": "status", + "type": "any", + "users": [ + "v15" + ] + }, + { + "id": "v16", + "opcode": "SaveState", + "type": "void", + "users": [ + "v15" + ] + }, + { + "id": "v15", + "imms": [ + 2 + ], + "inputs": [ + "v10", + "v14", + "v12", + "v16" + ], + "intrinsic_id": "Intrinsic.callthis1", + "opcode": "Intrinsic", + "type": "any", + "users": [ + "v22", + "v17" + ] + }, + { + "id": "v18", + "opcode": "SaveState", + "type": "void", + "users": [ + "v17" + ] + }, + { + "id": "v17", + "imms": [ + 4, + 693 + ], + "inputs": [ + "v15", + "v18" + ], + "intrinsic_id": "Intrinsic.ldobjbyname", + "opcode": "Intrinsic", + "string_data": "send", + "type": "any", + "users": [ + "v22" + ] + }, + { + "id": "v19", + "opcode": "SaveState", + "type": "void", + "users": [ + "v20" + ] + }, + { + "id": "v20", + "inputs": [ + "v19" + ], + "opcode": "LoadString", + "string": "Database query error", + "stringOffset": 461, + "type": "ref", + "users": [ + "v21" + ] + }, + { + "id": "v21", + "inputs": [ + "v20" + ], + "opcode": "CastValueToAnyType", + "type": "any", + "users": [ + "v22" + ] + }, + { + "id": "v23", + "opcode": "SaveState", + "type": "void", + "users": [ + "v22" + ] + }, + { + "id": "v22", + "imms": [ + 6 + ], + "inputs": [ + "v15", + "v21", + "v17", + "v23" + ], + "intrinsic_id": "Intrinsic.callthis1", + "opcode": "Intrinsic", + "type": "any" + }, + { + "id": "v25", + "opcode": "SaveState", + "type": "void", + "users": [ + "v24" + ] + }, + { + "id": "v24", + "inputs": [ + "v25" + ], + "intrinsic_id": "Intrinsic.ldundefined", + "opcode": "Intrinsic", + "type": "any" + }, + { + "id": "v27", + "opcode": "SaveState", + "type": "void", + "users": [ + "v26" + ] + }, + { + "id": "v26", + "inputs": [ + "v27" + ], + "intrinsic_id": "Intrinsic.ldundefined", + "opcode": "Intrinsic", + "type": "any" + }, + { + "id": "v29", + "opcode": "SaveState", + "type": "void", + "users": [ + "v28" + ] + }, + { + "id": "v28", + "inputs": [ + "v29" + ], + "intrinsic_id": "Intrinsic.returnundefined", + "opcode": "Intrinsic", + "type": "void" + } + ], + "isCatchBegin": false, + "isTryBegin": false, + "isTryEnd": false, + "predecessors": [ + 0 + ], + "successors": [ + 4 + ] + }, + { + "id": 1, + "insts": [ + { + "id": "v31", + "opcode": "SaveState", + "type": "void", + "users": [ + "v30" + ] + }, + { + "id": "v30", + "imms": [ + 0, + 0 + ], + "inputs": [ + "v31" + ], + "intrinsic_id": "Intrinsic.ldlexvar", + "lexenv": 0, + "lexvar": 0, + "opcode": "Intrinsic", + "type": "any", + "users": [ + "v34", + "v32" + ] + }, + { + "id": "v33", + "opcode": "SaveState", + "type": "void", + "users": [ + "v32" + ] + }, + { + "id": "v32", + "imms": [ + 8, + 650 + ], + "inputs": [ + "v30", + "v33" + ], + "intrinsic_id": "Intrinsic.ldobjbyname", + "opcode": "Intrinsic", + "string_data": "json", + "type": "any", + "users": [ + "v34" + ] + }, + { + "id": "v35", + "opcode": "SaveState", + "type": "void", + "users": [ + "v34" + ] + }, + { + "id": "v34", + "imms": [ + 10 + ], + "inputs": [ + "v30", + "v4", + "v32", + "v35" + ], + "intrinsic_id": "Intrinsic.callthis1", + "opcode": "Intrinsic", + "type": "any" + }, + { + "id": "v37", + "opcode": "SaveState", + "type": "void", + "users": [ + "v36" + ] + }, + { + "id": "v36", + "inputs": [ + "v37" + ], + "intrinsic_id": "Intrinsic.ldundefined", + "opcode": "Intrinsic", + "type": "any" + }, + { + "id": "v39", + "opcode": "SaveState", + "type": "void", + "users": [ + "v38" + ] + }, + { + "id": "v38", + "inputs": [ + "v39" + ], + "intrinsic_id": "Intrinsic.returnundefined", + "opcode": "Intrinsic", + "type": "void" + } + ], + "isCatchBegin": false, + "isTryBegin": false, + "isTryEnd": false, + "predecessors": [ + 0 + ], + "successors": [ + 4 + ] + }, + { + "id": 4, + "isCatchBegin": false, + "isTryBegin": false, + "isTryEnd": false, + "predecessors": [ + 2, + 1 + ] + } + ], + "name": "#15727984211755898705#", + "returnType": "any", + "signature": ".#15727984211755898705#" + }, + "name": "" + } + ] + } + ] +} \ No newline at end of file diff --git a/jacodb-panda-dynamic/src/test/resources/samples/taintSamples/SQLInjection2.ts b/jacodb-panda-dynamic/src/test/resources/samples/taintSamples/SQLInjection2.ts new file mode 100644 index 000000000..6fbeb5413 --- /dev/null +++ b/jacodb-panda-dynamic/src/test/resources/samples/taintSamples/SQLInjection2.ts @@ -0,0 +1,45 @@ +class Connection { + constructor(obj) {} + connect(callback) {} +} + +class app { + static connect(path, callback) {} + static listen(port, callback) {} +} + +const port = 3000; + +const connection = Connection({ + dbms: 'mysql', + host: 'localhost', + user: 'root', + password: '', + database: 'test_db' +}); + +connection.connect(err => { + if (err) { + console.error('Error connecting to database:', err); + return; + } + console.log('Connected to database'); +}); + +app.get('/user', (req, res) => { + const user = req.getUser(); + + const query = `SELECT * FROM users WHERE username = '${user}'`; + connection.query(query, (err, results) => { + if (err) { + res.status(500).send('Database query error'); + return; + } + res.json(results); + }); +}); + + +app.listen(port, () => { + console.log(`Server is running on http://localhost:${port}`); +}); diff --git a/jacodb-panda-dynamic/src/test/resources/samples/taintSamples/SQLInjection3.json b/jacodb-panda-dynamic/src/test/resources/samples/taintSamples/SQLInjection3.json new file mode 100644 index 000000000..eb9cfa666 --- /dev/null +++ b/jacodb-panda-dynamic/src/test/resources/samples/taintSamples/SQLInjection3.json @@ -0,0 +1,2509 @@ +{ + "classes": [ + { + "name": "GLOBAL", + "properties": [ + { + "method": { + "accessFlags": 264, + "basicBlocks": [ + { + "id": 1, + "insts": [ + { + "id": "v0", + "index": 0, + "opcode": "Parameter", + "type": "any" + }, + { + "id": "v1", + "index": 1, + "opcode": "Parameter", + "type": "any", + "users": [ + "v5" + ] + }, + { + "id": "v2", + "index": 2, + "opcode": "Parameter", + "type": "any", + "users": [ + "v7" + ] + }, + { + "id": "v15", + "opcode": "Constant", + "type": "i32", + "users": [ + "v16" + ], + "value": 3000 + } + ], + "isCatchBegin": false, + "isTryBegin": false, + "isTryEnd": false, + "successors": [ + 0 + ] + }, + { + "id": 0, + "insts": [ + { + "id": "v4", + "opcode": "SaveState", + "type": "void", + "users": [ + "v3" + ] + }, + { + "id": "v3", + "imms": [ + 4 + ], + "inputs": [ + "v4" + ], + "intrinsic_id": "Intrinsic.newlexenv", + "opcode": "Intrinsic", + "type": "any" + }, + { + "id": "v6", + "opcode": "SaveState", + "type": "void", + "users": [ + "v5" + ] + }, + { + "id": "v5", + "imms": [ + 0, + 2 + ], + "inputs": [ + "v1", + "v6" + ], + "intrinsic_id": "Intrinsic.stlexvar", + "lexenv": 0, + "lexvar": 2, + "opcode": "Intrinsic", + "type": "void" + }, + { + "id": "v8", + "opcode": "SaveState", + "type": "void", + "users": [ + "v7" + ] + }, + { + "id": "v7", + "imms": [ + 0, + 3 + ], + "inputs": [ + "v2", + "v8" + ], + "intrinsic_id": "Intrinsic.stlexvar", + "lexenv": 0, + "lexvar": 3, + "opcode": "Intrinsic", + "type": "void" + }, + { + "id": "v10", + "opcode": "SaveState", + "type": "void", + "users": [ + "v9" + ] + }, + { + "id": "v9", + "imms": [ + 0 + ], + "inputs": [ + "v10" + ], + "intrinsic_id": "Intrinsic.getmodulenamespace", + "opcode": "Intrinsic", + "type": "any", + "users": [ + "v13" + ] + }, + { + "id": "v12", + "opcode": "SaveState", + "type": "void", + "users": [ + "v11" + ] + }, + { + "id": "v11", + "imms": [ + 1 + ], + "inputs": [ + "v12" + ], + "intrinsic_id": "Intrinsic.getmodulenamespace", + "opcode": "Intrinsic", + "type": "any", + "users": [ + "v22", + "v18" + ] + }, + { + "id": "v14", + "opcode": "SaveState", + "type": "void", + "users": [ + "v13" + ] + }, + { + "id": "v13", + "imms": [ + 0 + ], + "inputs": [ + "v9", + "v14" + ], + "intrinsic_id": "Intrinsic.callarg0", + "opcode": "Intrinsic", + "type": "any", + "users": [ + "v53", + "v45", + "v43", + "v36" + ] + }, + { + "id": "v17", + "opcode": "SaveState", + "type": "void", + "users": [ + "v16" + ] + }, + { + "id": "v16", + "imms": [ + 0, + 1 + ], + "inputs": [ + "v15", + "v17" + ], + "intrinsic_id": "Intrinsic.stlexvar", + "lexenv": 0, + "lexvar": 1, + "opcode": "Intrinsic", + "type": "void" + }, + { + "id": "v19", + "opcode": "SaveState", + "type": "void", + "users": [ + "v18" + ] + }, + { + "id": "v18", + "imms": [ + 2, + 577 + ], + "inputs": [ + "v11", + "v19" + ], + "intrinsic_id": "Intrinsic.ldobjbyname", + "opcode": "Intrinsic", + "string_data": "createConnection", + "type": "any", + "users": [ + "v22" + ] + }, + { + "id": "v21", + "opcode": "SaveState", + "type": "void", + "users": [ + "v20" + ] + }, + { + "id": "v20", + "imms": [ + 4, + 1152 + ], + "inputs": [ + "v21" + ], + "intrinsic_id": "Intrinsic.createobjectwithbuffer", + "opcode": "Intrinsic", + "string_data": "", + "type": "any", + "users": [ + "v22" + ] + }, + { + "id": "v23", + "opcode": "SaveState", + "type": "void", + "users": [ + "v22" + ] + }, + { + "id": "v22", + "imms": [ + 5 + ], + "inputs": [ + "v11", + "v20", + "v18", + "v23" + ], + "intrinsic_id": "Intrinsic.callthis1", + "opcode": "Intrinsic", + "type": "any", + "users": [ + "v24" + ] + }, + { + "id": "v25", + "opcode": "SaveState", + "type": "void", + "users": [ + "v24" + ] + }, + { + "id": "v24", + "imms": [ + 0, + 0 + ], + "inputs": [ + "v22", + "v25" + ], + "intrinsic_id": "Intrinsic.stlexvar", + "lexenv": 0, + "lexvar": 0, + "opcode": "Intrinsic", + "type": "void" + }, + { + "id": "v27", + "opcode": "SaveState", + "type": "void", + "users": [ + "v26" + ] + }, + { + "id": "v26", + "imms": [ + 0, + 0 + ], + "inputs": [ + "v27" + ], + "intrinsic_id": "Intrinsic.ldlexvar", + "lexenv": 0, + "lexvar": 0, + "opcode": "Intrinsic", + "type": "any", + "users": [ + "v34", + "v30", + "v28" + ] + }, + { + "id": "v29", + "opcode": "SaveState", + "type": "void", + "users": [ + "v28" + ] + }, + { + "id": "v28", + "imms": [ + 556 + ], + "inputs": [ + "v26", + "v29" + ], + "intrinsic_id": "Intrinsic.throw.undefinedifholewithname", + "opcode": "Intrinsic", + "type": "void" + }, + { + "id": "v31", + "opcode": "SaveState", + "type": "void", + "users": [ + "v30" + ] + }, + { + "id": "v30", + "imms": [ + 7, + 547 + ], + "inputs": [ + "v26", + "v31" + ], + "intrinsic_id": "Intrinsic.ldobjbyname", + "opcode": "Intrinsic", + "string_data": "connect", + "type": "any", + "users": [ + "v34" + ] + }, + { + "id": "v33", + "opcode": "SaveState", + "type": "void", + "users": [ + "v32" + ] + }, + { + "functionName": ".#3048179105868511693#", + "id": "v32", + "imms": [ + 9, + 909, + 1 + ], + "inputs": [ + "v33" + ], + "intrinsic_id": "Intrinsic.definefunc", + "opcode": "Intrinsic", + "type": "any", + "users": [ + "v34" + ] + }, + { + "id": "v35", + "opcode": "SaveState", + "type": "void", + "users": [ + "v34" + ] + }, + { + "id": "v34", + "imms": [ + 10 + ], + "inputs": [ + "v26", + "v32", + "v30", + "v35" + ], + "intrinsic_id": "Intrinsic.callthis1", + "opcode": "Intrinsic", + "type": "any" + }, + { + "id": "v37", + "opcode": "SaveState", + "type": "void", + "users": [ + "v36" + ] + }, + { + "id": "v36", + "imms": [ + 12, + 602 + ], + "inputs": [ + "v13", + "v37" + ], + "intrinsic_id": "Intrinsic.ldobjbyname", + "opcode": "Intrinsic", + "string_data": "get", + "type": "any", + "users": [ + "v43" + ] + }, + { + "id": "v38", + "opcode": "SaveState", + "type": "void", + "users": [ + "v39" + ] + }, + { + "id": "v39", + "inputs": [ + "v38" + ], + "opcode": "LoadString", + "string": "/user", + "stringOffset": 384, + "type": "ref", + "users": [ + "v40" + ] + }, + { + "id": "v40", + "inputs": [ + "v39" + ], + "opcode": "CastValueToAnyType", + "type": "any", + "users": [ + "v43" + ] + }, + { + "id": "v42", + "opcode": "SaveState", + "type": "void", + "users": [ + "v41" + ] + }, + { + "functionName": ".#10829517249087095472#", + "id": "v41", + "imms": [ + 14, + 965, + 2 + ], + "inputs": [ + "v42" + ], + "intrinsic_id": "Intrinsic.definefunc", + "opcode": "Intrinsic", + "type": "any", + "users": [ + "v43" + ] + }, + { + "id": "v44", + "opcode": "SaveState", + "type": "void", + "users": [ + "v43" + ] + }, + { + "id": "v43", + "imms": [ + 15 + ], + "inputs": [ + "v13", + "v40", + "v41", + "v36", + "v44" + ], + "intrinsic_id": "Intrinsic.callthis2", + "opcode": "Intrinsic", + "type": "any" + }, + { + "id": "v46", + "opcode": "SaveState", + "type": "void", + "users": [ + "v45" + ] + }, + { + "id": "v45", + "imms": [ + 17, + 622 + ], + "inputs": [ + "v13", + "v46" + ], + "intrinsic_id": "Intrinsic.ldobjbyname", + "opcode": "Intrinsic", + "string_data": "listen", + "type": "any", + "users": [ + "v53" + ] + }, + { + "id": "v48", + "opcode": "SaveState", + "type": "void", + "users": [ + "v47" + ] + }, + { + "id": "v47", + "imms": [ + 0, + 1 + ], + "inputs": [ + "v48" + ], + "intrinsic_id": "Intrinsic.ldlexvar", + "lexenv": 0, + "lexvar": 1, + "opcode": "Intrinsic", + "type": "any", + "users": [ + "v53", + "v49" + ] + }, + { + "id": "v50", + "opcode": "SaveState", + "type": "void", + "users": [ + "v49" + ] + }, + { + "id": "v49", + "imms": [ + 635 + ], + "inputs": [ + "v47", + "v50" + ], + "intrinsic_id": "Intrinsic.throw.undefinedifholewithname", + "opcode": "Intrinsic", + "type": "void" + }, + { + "id": "v52", + "opcode": "SaveState", + "type": "void", + "users": [ + "v51" + ] + }, + { + "functionName": ".#5294593874550887413#", + "id": "v51", + "imms": [ + 19, + 937, + 0 + ], + "inputs": [ + "v52" + ], + "intrinsic_id": "Intrinsic.definefunc", + "opcode": "Intrinsic", + "type": "any", + "users": [ + "v53" + ] + }, + { + "id": "v54", + "opcode": "SaveState", + "type": "void", + "users": [ + "v53" + ] + }, + { + "id": "v53", + "imms": [ + 20 + ], + "inputs": [ + "v13", + "v47", + "v51", + "v45", + "v54" + ], + "intrinsic_id": "Intrinsic.callthis2", + "opcode": "Intrinsic", + "type": "any" + }, + { + "id": "v56", + "opcode": "SaveState", + "type": "void", + "users": [ + "v55" + ] + }, + { + "id": "v55", + "inputs": [ + "v56" + ], + "intrinsic_id": "Intrinsic.ldundefined", + "opcode": "Intrinsic", + "type": "any" + }, + { + "id": "v58", + "opcode": "SaveState", + "type": "void", + "users": [ + "v57" + ] + }, + { + "id": "v57", + "inputs": [ + "v58" + ], + "intrinsic_id": "Intrinsic.returnundefined", + "opcode": "Intrinsic", + "type": "void" + } + ], + "isCatchBegin": false, + "isTryBegin": false, + "isTryEnd": false, + "predecessors": [ + 1 + ], + "successors": [ + 2 + ] + }, + { + "id": 2, + "isCatchBegin": false, + "isTryBegin": false, + "isTryEnd": false, + "predecessors": [ + 0 + ] + } + ], + "name": "func_main_0", + "returnType": "any", + "signature": ".func_main_0" + }, + "name": "func_main_0" + }, + { + "method": { + "accessFlags": 520, + "basicBlocks": [ + { + "id": 3, + "insts": [ + { + "id": "v0", + "index": 0, + "opcode": "Parameter", + "type": "any" + }, + { + "id": "v1", + "index": 1, + "opcode": "Parameter", + "type": "any" + }, + { + "id": "v2", + "index": 2, + "opcode": "Parameter", + "type": "any" + }, + { + "id": "v3", + "index": 3, + "opcode": "Parameter", + "type": "any", + "users": [ + "v16", + "v4" + ] + }, + { + "id": "v7", + "opcode": "Constant", + "type": "i64", + "users": [ + "v6" + ], + "value": 0 + } + ], + "isCatchBegin": false, + "isTryBegin": false, + "isTryEnd": false, + "successors": [ + 0 + ] + }, + { + "id": 0, + "insts": [ + { + "id": "v5", + "opcode": "SaveState", + "type": "void", + "users": [ + "v4" + ] + }, + { + "id": "v4", + "inputs": [ + "v3", + "v5" + ], + "intrinsic_id": "Intrinsic.isfalse", + "opcode": "Intrinsic", + "type": "any", + "users": [ + "v6" + ] + }, + { + "id": "v6", + "inputs": [ + "v4", + "v7" + ], + "opcode": "Compare", + "operandsType": "any", + "operator": "NE", + "type": "u1", + "users": [ + "v8" + ] + }, + { + "id": "v8", + "immediate": 0, + "inputs": [ + "v6" + ], + "opcode": "IfImm", + "operandsType": "u1", + "operator": "NE", + "type": "void" + } + ], + "isCatchBegin": false, + "isTryBegin": false, + "isTryEnd": false, + "predecessors": [ + 3 + ], + "successors": [ + 1, + 2 + ] + }, + { + "id": 2, + "insts": [ + { + "id": "v10", + "opcode": "SaveState", + "type": "void", + "users": [ + "v9" + ] + }, + { + "id": "v9", + "imms": [ + 0, + 568 + ], + "inputs": [ + "v10" + ], + "intrinsic_id": "Intrinsic.tryldglobalbyname", + "opcode": "Intrinsic", + "string_data": "console", + "type": "any", + "users": [ + "v16", + "v11" + ] + }, + { + "id": "v12", + "opcode": "SaveState", + "type": "void", + "users": [ + "v11" + ] + }, + { + "id": "v11", + "imms": [ + 1, + 595 + ], + "inputs": [ + "v9", + "v12" + ], + "intrinsic_id": "Intrinsic.ldobjbyname", + "opcode": "Intrinsic", + "string_data": "error", + "type": "any", + "users": [ + "v16" + ] + }, + { + "id": "v13", + "opcode": "SaveState", + "type": "void", + "users": [ + "v14" + ] + }, + { + "id": "v14", + "inputs": [ + "v13" + ], + "opcode": "LoadString", + "string": "Error connecting to database:", + "stringOffset": 436, + "type": "ref", + "users": [ + "v15" + ] + }, + { + "id": "v15", + "inputs": [ + "v14" + ], + "opcode": "CastValueToAnyType", + "type": "any", + "users": [ + "v16" + ] + }, + { + "id": "v17", + "opcode": "SaveState", + "type": "void", + "users": [ + "v16" + ] + }, + { + "id": "v16", + "imms": [ + 3 + ], + "inputs": [ + "v9", + "v15", + "v3", + "v11", + "v17" + ], + "intrinsic_id": "Intrinsic.callthis2", + "opcode": "Intrinsic", + "type": "any" + }, + { + "id": "v19", + "opcode": "SaveState", + "type": "void", + "users": [ + "v18" + ] + }, + { + "id": "v18", + "inputs": [ + "v19" + ], + "intrinsic_id": "Intrinsic.ldundefined", + "opcode": "Intrinsic", + "type": "any" + }, + { + "id": "v21", + "opcode": "SaveState", + "type": "void", + "users": [ + "v20" + ] + }, + { + "id": "v20", + "inputs": [ + "v21" + ], + "intrinsic_id": "Intrinsic.ldundefined", + "opcode": "Intrinsic", + "type": "any" + }, + { + "id": "v23", + "opcode": "SaveState", + "type": "void", + "users": [ + "v22" + ] + }, + { + "id": "v22", + "inputs": [ + "v23" + ], + "intrinsic_id": "Intrinsic.returnundefined", + "opcode": "Intrinsic", + "type": "void" + } + ], + "isCatchBegin": false, + "isTryBegin": false, + "isTryEnd": false, + "predecessors": [ + 0 + ], + "successors": [ + 4 + ] + }, + { + "id": 1, + "insts": [ + { + "id": "v25", + "opcode": "SaveState", + "type": "void", + "users": [ + "v24" + ] + }, + { + "id": "v24", + "imms": [ + 5, + 568 + ], + "inputs": [ + "v25" + ], + "intrinsic_id": "Intrinsic.tryldglobalbyname", + "opcode": "Intrinsic", + "string_data": "console", + "type": "any", + "users": [ + "v31", + "v26" + ] + }, + { + "id": "v27", + "opcode": "SaveState", + "type": "void", + "users": [ + "v26" + ] + }, + { + "id": "v26", + "imms": [ + 6, + 630 + ], + "inputs": [ + "v24", + "v27" + ], + "intrinsic_id": "Intrinsic.ldobjbyname", + "opcode": "Intrinsic", + "string_data": "log", + "type": "any", + "users": [ + "v31" + ] + }, + { + "id": "v28", + "opcode": "SaveState", + "type": "void", + "users": [ + "v29" + ] + }, + { + "id": "v29", + "inputs": [ + "v28" + ], + "opcode": "LoadString", + "string": "Connected to database", + "stringOffset": 391, + "type": "ref", + "users": [ + "v30" + ] + }, + { + "id": "v30", + "inputs": [ + "v29" + ], + "opcode": "CastValueToAnyType", + "type": "any", + "users": [ + "v31" + ] + }, + { + "id": "v32", + "opcode": "SaveState", + "type": "void", + "users": [ + "v31" + ] + }, + { + "id": "v31", + "imms": [ + 8 + ], + "inputs": [ + "v24", + "v30", + "v26", + "v32" + ], + "intrinsic_id": "Intrinsic.callthis1", + "opcode": "Intrinsic", + "type": "any" + }, + { + "id": "v34", + "opcode": "SaveState", + "type": "void", + "users": [ + "v33" + ] + }, + { + "id": "v33", + "inputs": [ + "v34" + ], + "intrinsic_id": "Intrinsic.ldundefined", + "opcode": "Intrinsic", + "type": "any" + }, + { + "id": "v36", + "opcode": "SaveState", + "type": "void", + "users": [ + "v35" + ] + }, + { + "id": "v35", + "inputs": [ + "v36" + ], + "intrinsic_id": "Intrinsic.returnundefined", + "opcode": "Intrinsic", + "type": "void" + } + ], + "isCatchBegin": false, + "isTryBegin": false, + "isTryEnd": false, + "predecessors": [ + 0 + ], + "successors": [ + 4 + ] + }, + { + "id": 4, + "isCatchBegin": false, + "isTryBegin": false, + "isTryEnd": false, + "predecessors": [ + 2, + 1 + ] + } + ], + "name": "#3048179105868511693#", + "returnType": "any", + "signature": ".#3048179105868511693#" + }, + "name": "" + }, + { + "method": { + "accessFlags": 520, + "basicBlocks": [ + { + "id": 1, + "insts": [ + { + "id": "v0", + "index": 0, + "opcode": "Parameter", + "type": "any" + }, + { + "id": "v1", + "index": 1, + "opcode": "Parameter", + "type": "any" + }, + { + "id": "v2", + "index": 2, + "opcode": "Parameter", + "type": "any" + } + ], + "isCatchBegin": false, + "isTryBegin": false, + "isTryEnd": false, + "successors": [ + 0 + ] + }, + { + "id": 0, + "insts": [ + { + "id": "v4", + "opcode": "SaveState", + "type": "void", + "users": [ + "v3" + ] + }, + { + "id": "v3", + "imms": [ + 0, + 568 + ], + "inputs": [ + "v4" + ], + "intrinsic_id": "Intrinsic.tryldglobalbyname", + "opcode": "Intrinsic", + "string_data": "console", + "type": "any", + "users": [ + "v21", + "v5" + ] + }, + { + "id": "v6", + "opcode": "SaveState", + "type": "void", + "users": [ + "v5" + ] + }, + { + "id": "v5", + "imms": [ + 1, + 630 + ], + "inputs": [ + "v3", + "v6" + ], + "intrinsic_id": "Intrinsic.ldobjbyname", + "opcode": "Intrinsic", + "string_data": "log", + "type": "any", + "users": [ + "v21" + ] + }, + { + "id": "v7", + "opcode": "SaveState", + "type": "void", + "users": [ + "v8" + ] + }, + { + "id": "v8", + "inputs": [ + "v7" + ], + "opcode": "LoadString", + "string": "Server is running on http://localhost:", + "stringOffset": 507, + "type": "ref", + "users": [ + "v9" + ] + }, + { + "id": "v9", + "inputs": [ + "v8" + ], + "opcode": "CastValueToAnyType", + "type": "any", + "users": [ + "v14" + ] + }, + { + "id": "v11", + "opcode": "SaveState", + "type": "void", + "users": [ + "v10" + ] + }, + { + "id": "v10", + "imms": [ + 0, + 1 + ], + "inputs": [ + "v11" + ], + "intrinsic_id": "Intrinsic.ldlexvar", + "lexenv": 0, + "lexvar": 1, + "opcode": "Intrinsic", + "type": "any", + "users": [ + "v14", + "v12" + ] + }, + { + "id": "v13", + "opcode": "SaveState", + "type": "void", + "users": [ + "v12" + ] + }, + { + "id": "v12", + "imms": [ + 635 + ], + "inputs": [ + "v10", + "v13" + ], + "intrinsic_id": "Intrinsic.throw.undefinedifholewithname", + "opcode": "Intrinsic", + "type": "void" + }, + { + "id": "v15", + "opcode": "SaveState", + "type": "void", + "users": [ + "v14" + ] + }, + { + "id": "v14", + "imms": [ + 3 + ], + "inputs": [ + "v9", + "v10", + "v15" + ], + "intrinsic_id": "Intrinsic.add2", + "opcode": "Intrinsic", + "type": "any", + "users": [ + "v19" + ] + }, + { + "id": "v16", + "opcode": "SaveState", + "type": "void", + "users": [ + "v17" + ] + }, + { + "id": "v17", + "inputs": [ + "v16" + ], + "opcode": "LoadString", + "string": "", + "stringOffset": 281, + "type": "ref", + "users": [ + "v18" + ] + }, + { + "id": "v18", + "inputs": [ + "v17" + ], + "opcode": "CastValueToAnyType", + "type": "any", + "users": [ + "v19" + ] + }, + { + "id": "v20", + "opcode": "SaveState", + "type": "void", + "users": [ + "v19" + ] + }, + { + "id": "v19", + "imms": [ + 4 + ], + "inputs": [ + "v14", + "v18", + "v20" + ], + "intrinsic_id": "Intrinsic.add2", + "opcode": "Intrinsic", + "type": "any", + "users": [ + "v21" + ] + }, + { + "id": "v22", + "opcode": "SaveState", + "type": "void", + "users": [ + "v21" + ] + }, + { + "id": "v21", + "imms": [ + 5 + ], + "inputs": [ + "v3", + "v19", + "v5", + "v22" + ], + "intrinsic_id": "Intrinsic.callthis1", + "opcode": "Intrinsic", + "type": "any" + }, + { + "id": "v24", + "opcode": "SaveState", + "type": "void", + "users": [ + "v23" + ] + }, + { + "id": "v23", + "inputs": [ + "v24" + ], + "intrinsic_id": "Intrinsic.ldundefined", + "opcode": "Intrinsic", + "type": "any" + }, + { + "id": "v26", + "opcode": "SaveState", + "type": "void", + "users": [ + "v25" + ] + }, + { + "id": "v25", + "inputs": [ + "v26" + ], + "intrinsic_id": "Intrinsic.returnundefined", + "opcode": "Intrinsic", + "type": "void" + } + ], + "isCatchBegin": false, + "isTryBegin": false, + "isTryEnd": false, + "predecessors": [ + 1 + ], + "successors": [ + 2 + ] + }, + { + "id": 2, + "isCatchBegin": false, + "isTryBegin": false, + "isTryEnd": false, + "predecessors": [ + 0 + ] + } + ], + "name": "#5294593874550887413#", + "returnType": "any", + "signature": ".#5294593874550887413#" + }, + "name": "" + }, + { + "method": { + "accessFlags": 520, + "basicBlocks": [ + { + "id": 1, + "insts": [ + { + "id": "v0", + "index": 0, + "opcode": "Parameter", + "type": "any" + }, + { + "id": "v1", + "index": 1, + "opcode": "Parameter", + "type": "any" + }, + { + "id": "v2", + "index": 2, + "opcode": "Parameter", + "type": "any" + }, + { + "id": "v3", + "index": 3, + "opcode": "Parameter", + "type": "any", + "users": [ + "v9" + ] + }, + { + "id": "v4", + "index": 4, + "opcode": "Parameter", + "type": "any", + "users": [ + "v7" + ] + } + ], + "isCatchBegin": false, + "isTryBegin": false, + "isTryEnd": false, + "successors": [ + 0 + ] + }, + { + "id": 0, + "insts": [ + { + "id": "v6", + "opcode": "SaveState", + "type": "void", + "users": [ + "v5" + ] + }, + { + "id": "v5", + "imms": [ + 1 + ], + "inputs": [ + "v6" + ], + "intrinsic_id": "Intrinsic.newlexenv", + "opcode": "Intrinsic", + "type": "any" + }, + { + "id": "v8", + "opcode": "SaveState", + "type": "void", + "users": [ + "v7" + ] + }, + { + "id": "v7", + "imms": [ + 0, + 0 + ], + "inputs": [ + "v4", + "v8" + ], + "intrinsic_id": "Intrinsic.stlexvar", + "lexenv": 0, + "lexvar": 0, + "opcode": "Intrinsic", + "type": "void" + }, + { + "id": "v10", + "opcode": "SaveState", + "type": "void", + "users": [ + "v9" + ] + }, + { + "id": "v9", + "imms": [ + 0, + 641 + ], + "inputs": [ + "v3", + "v10" + ], + "intrinsic_id": "Intrinsic.ldobjbyname", + "opcode": "Intrinsic", + "string_data": "query", + "type": "any", + "users": [ + "v13", + "v11" + ] + }, + { + "id": "v12", + "opcode": "SaveState", + "type": "void", + "users": [ + "v11" + ] + }, + { + "id": "v11", + "imms": [ + 2, + 607 + ], + "inputs": [ + "v9", + "v12" + ], + "intrinsic_id": "Intrinsic.ldobjbyname", + "opcode": "Intrinsic", + "string_data": "getUser", + "type": "any", + "users": [ + "v13" + ] + }, + { + "id": "v14", + "opcode": "SaveState", + "type": "void", + "users": [ + "v13" + ] + }, + { + "id": "v13", + "imms": [ + 4 + ], + "inputs": [ + "v9", + "v11", + "v14" + ], + "intrinsic_id": "Intrinsic.callthis0", + "opcode": "Intrinsic", + "type": "any", + "users": [ + "v18" + ] + }, + { + "id": "v15", + "opcode": "SaveState", + "type": "void", + "users": [ + "v16" + ] + }, + { + "id": "v16", + "inputs": [ + "v15" + ], + "opcode": "LoadString", + "string": "SELECT * FROM users WHERE username = \\'", + "stringOffset": 467, + "type": "ref", + "users": [ + "v17" + ] + }, + { + "id": "v17", + "inputs": [ + "v16" + ], + "opcode": "CastValueToAnyType", + "type": "any", + "users": [ + "v18" + ] + }, + { + "id": "v19", + "opcode": "SaveState", + "type": "void", + "users": [ + "v18" + ] + }, + { + "id": "v18", + "imms": [ + 6 + ], + "inputs": [ + "v17", + "v13", + "v19" + ], + "intrinsic_id": "Intrinsic.add2", + "opcode": "Intrinsic", + "type": "any", + "users": [ + "v23" + ] + }, + { + "id": "v20", + "opcode": "SaveState", + "type": "void", + "users": [ + "v21" + ] + }, + { + "id": "v21", + "inputs": [ + "v20" + ], + "opcode": "LoadString", + "string": "\\'", + "stringOffset": 283, + "type": "ref", + "users": [ + "v22" + ] + }, + { + "id": "v22", + "inputs": [ + "v21" + ], + "opcode": "CastValueToAnyType", + "type": "any", + "users": [ + "v23" + ] + }, + { + "id": "v24", + "opcode": "SaveState", + "type": "void", + "users": [ + "v23" + ] + }, + { + "id": "v23", + "imms": [ + 7 + ], + "inputs": [ + "v18", + "v22", + "v24" + ], + "intrinsic_id": "Intrinsic.add2", + "opcode": "Intrinsic", + "type": "any", + "users": [ + "v33" + ] + }, + { + "id": "v26", + "opcode": "SaveState", + "type": "void", + "users": [ + "v25" + ] + }, + { + "id": "v25", + "imms": [ + 1, + 0 + ], + "inputs": [ + "v26" + ], + "intrinsic_id": "Intrinsic.ldlexvar", + "lexenv": 1, + "lexvar": 0, + "opcode": "Intrinsic", + "type": "any", + "users": [ + "v33", + "v29", + "v27" + ] + }, + { + "id": "v28", + "opcode": "SaveState", + "type": "void", + "users": [ + "v27" + ] + }, + { + "id": "v27", + "imms": [ + 556 + ], + "inputs": [ + "v25", + "v28" + ], + "intrinsic_id": "Intrinsic.throw.undefinedifholewithname", + "opcode": "Intrinsic", + "type": "void" + }, + { + "id": "v30", + "opcode": "SaveState", + "type": "void", + "users": [ + "v29" + ] + }, + { + "id": "v29", + "imms": [ + 8, + 641 + ], + "inputs": [ + "v25", + "v30" + ], + "intrinsic_id": "Intrinsic.ldobjbyname", + "opcode": "Intrinsic", + "string_data": "query", + "type": "any", + "users": [ + "v33" + ] + }, + { + "id": "v32", + "opcode": "SaveState", + "type": "void", + "users": [ + "v31" + ] + }, + { + "functionName": ".#15727984211755898705#", + "id": "v31", + "imms": [ + 10, + 993, + 2 + ], + "inputs": [ + "v32" + ], + "intrinsic_id": "Intrinsic.definefunc", + "opcode": "Intrinsic", + "type": "any", + "users": [ + "v33" + ] + }, + { + "id": "v34", + "opcode": "SaveState", + "type": "void", + "users": [ + "v33" + ] + }, + { + "id": "v33", + "imms": [ + 11 + ], + "inputs": [ + "v25", + "v23", + "v31", + "v29", + "v34" + ], + "intrinsic_id": "Intrinsic.callthis2", + "opcode": "Intrinsic", + "type": "any" + }, + { + "id": "v36", + "opcode": "SaveState", + "type": "void", + "users": [ + "v35" + ] + }, + { + "id": "v35", + "inputs": [ + "v36" + ], + "intrinsic_id": "Intrinsic.ldundefined", + "opcode": "Intrinsic", + "type": "any" + }, + { + "id": "v38", + "opcode": "SaveState", + "type": "void", + "users": [ + "v37" + ] + }, + { + "id": "v37", + "inputs": [ + "v38" + ], + "intrinsic_id": "Intrinsic.returnundefined", + "opcode": "Intrinsic", + "type": "void" + } + ], + "isCatchBegin": false, + "isTryBegin": false, + "isTryEnd": false, + "predecessors": [ + 1 + ], + "successors": [ + 2 + ] + }, + { + "id": 2, + "isCatchBegin": false, + "isTryBegin": false, + "isTryEnd": false, + "predecessors": [ + 0 + ] + } + ], + "name": "#10829517249087095472#", + "returnType": "any", + "signature": ".#10829517249087095472#" + }, + "name": "" + }, + { + "method": { + "accessFlags": 520, + "basicBlocks": [ + { + "id": 3, + "insts": [ + { + "id": "v0", + "index": 0, + "opcode": "Parameter", + "type": "any" + }, + { + "id": "v1", + "index": 1, + "opcode": "Parameter", + "type": "any" + }, + { + "id": "v2", + "index": 2, + "opcode": "Parameter", + "type": "any" + }, + { + "id": "v3", + "index": 3, + "opcode": "Parameter", + "type": "any", + "users": [ + "v5" + ] + }, + { + "id": "v4", + "index": 4, + "opcode": "Parameter", + "type": "any", + "users": [ + "v34" + ] + }, + { + "id": "v8", + "opcode": "Constant", + "type": "i64", + "users": [ + "v7" + ], + "value": 0 + }, + { + "id": "v14", + "opcode": "Constant", + "type": "i32", + "users": [ + "v15" + ], + "value": 500 + } + ], + "isCatchBegin": false, + "isTryBegin": false, + "isTryEnd": false, + "successors": [ + 0 + ] + }, + { + "id": 0, + "insts": [ + { + "id": "v6", + "opcode": "SaveState", + "type": "void", + "users": [ + "v5" + ] + }, + { + "id": "v5", + "inputs": [ + "v3", + "v6" + ], + "intrinsic_id": "Intrinsic.isfalse", + "opcode": "Intrinsic", + "type": "any", + "users": [ + "v7" + ] + }, + { + "id": "v7", + "inputs": [ + "v5", + "v8" + ], + "opcode": "Compare", + "operandsType": "any", + "operator": "NE", + "type": "u1", + "users": [ + "v9" + ] + }, + { + "id": "v9", + "immediate": 0, + "inputs": [ + "v7" + ], + "opcode": "IfImm", + "operandsType": "u1", + "operator": "NE", + "type": "void" + } + ], + "isCatchBegin": false, + "isTryBegin": false, + "isTryEnd": false, + "predecessors": [ + 3 + ], + "successors": [ + 1, + 2 + ] + }, + { + "id": 2, + "insts": [ + { + "id": "v11", + "opcode": "SaveState", + "type": "void", + "users": [ + "v10" + ] + }, + { + "id": "v10", + "imms": [ + 0, + 0 + ], + "inputs": [ + "v11" + ], + "intrinsic_id": "Intrinsic.ldlexvar", + "lexenv": 0, + "lexvar": 0, + "opcode": "Intrinsic", + "type": "any", + "users": [ + "v15", + "v12" + ] + }, + { + "id": "v13", + "opcode": "SaveState", + "type": "void", + "users": [ + "v12" + ] + }, + { + "id": "v12", + "imms": [ + 0, + 654 + ], + "inputs": [ + "v10", + "v13" + ], + "intrinsic_id": "Intrinsic.ldobjbyname", + "opcode": "Intrinsic", + "string_data": "status", + "type": "any", + "users": [ + "v15" + ] + }, + { + "id": "v16", + "opcode": "SaveState", + "type": "void", + "users": [ + "v15" + ] + }, + { + "id": "v15", + "imms": [ + 2 + ], + "inputs": [ + "v10", + "v14", + "v12", + "v16" + ], + "intrinsic_id": "Intrinsic.callthis1", + "opcode": "Intrinsic", + "type": "any", + "users": [ + "v22", + "v17" + ] + }, + { + "id": "v18", + "opcode": "SaveState", + "type": "void", + "users": [ + "v17" + ] + }, + { + "id": "v17", + "imms": [ + 4, + 648 + ], + "inputs": [ + "v15", + "v18" + ], + "intrinsic_id": "Intrinsic.ldobjbyname", + "opcode": "Intrinsic", + "string_data": "send", + "type": "any", + "users": [ + "v22" + ] + }, + { + "id": "v19", + "opcode": "SaveState", + "type": "void", + "users": [ + "v20" + ] + }, + { + "id": "v20", + "inputs": [ + "v19" + ], + "opcode": "LoadString", + "string": "Database query error", + "stringOffset": 414, + "type": "ref", + "users": [ + "v21" + ] + }, + { + "id": "v21", + "inputs": [ + "v20" + ], + "opcode": "CastValueToAnyType", + "type": "any", + "users": [ + "v22" + ] + }, + { + "id": "v23", + "opcode": "SaveState", + "type": "void", + "users": [ + "v22" + ] + }, + { + "id": "v22", + "imms": [ + 6 + ], + "inputs": [ + "v15", + "v21", + "v17", + "v23" + ], + "intrinsic_id": "Intrinsic.callthis1", + "opcode": "Intrinsic", + "type": "any" + }, + { + "id": "v25", + "opcode": "SaveState", + "type": "void", + "users": [ + "v24" + ] + }, + { + "id": "v24", + "inputs": [ + "v25" + ], + "intrinsic_id": "Intrinsic.ldundefined", + "opcode": "Intrinsic", + "type": "any" + }, + { + "id": "v27", + "opcode": "SaveState", + "type": "void", + "users": [ + "v26" + ] + }, + { + "id": "v26", + "inputs": [ + "v27" + ], + "intrinsic_id": "Intrinsic.ldundefined", + "opcode": "Intrinsic", + "type": "any" + }, + { + "id": "v29", + "opcode": "SaveState", + "type": "void", + "users": [ + "v28" + ] + }, + { + "id": "v28", + "inputs": [ + "v29" + ], + "intrinsic_id": "Intrinsic.returnundefined", + "opcode": "Intrinsic", + "type": "void" + } + ], + "isCatchBegin": false, + "isTryBegin": false, + "isTryEnd": false, + "predecessors": [ + 0 + ], + "successors": [ + 4 + ] + }, + { + "id": 1, + "insts": [ + { + "id": "v31", + "opcode": "SaveState", + "type": "void", + "users": [ + "v30" + ] + }, + { + "id": "v30", + "imms": [ + 0, + 0 + ], + "inputs": [ + "v31" + ], + "intrinsic_id": "Intrinsic.ldlexvar", + "lexenv": 0, + "lexvar": 0, + "opcode": "Intrinsic", + "type": "any", + "users": [ + "v34", + "v32" + ] + }, + { + "id": "v33", + "opcode": "SaveState", + "type": "void", + "users": [ + "v32" + ] + }, + { + "id": "v32", + "imms": [ + 8, + 616 + ], + "inputs": [ + "v30", + "v33" + ], + "intrinsic_id": "Intrinsic.ldobjbyname", + "opcode": "Intrinsic", + "string_data": "json", + "type": "any", + "users": [ + "v34" + ] + }, + { + "id": "v35", + "opcode": "SaveState", + "type": "void", + "users": [ + "v34" + ] + }, + { + "id": "v34", + "imms": [ + 10 + ], + "inputs": [ + "v30", + "v4", + "v32", + "v35" + ], + "intrinsic_id": "Intrinsic.callthis1", + "opcode": "Intrinsic", + "type": "any" + }, + { + "id": "v37", + "opcode": "SaveState", + "type": "void", + "users": [ + "v36" + ] + }, + { + "id": "v36", + "inputs": [ + "v37" + ], + "intrinsic_id": "Intrinsic.ldundefined", + "opcode": "Intrinsic", + "type": "any" + }, + { + "id": "v39", + "opcode": "SaveState", + "type": "void", + "users": [ + "v38" + ] + }, + { + "id": "v38", + "inputs": [ + "v39" + ], + "intrinsic_id": "Intrinsic.returnundefined", + "opcode": "Intrinsic", + "type": "void" + } + ], + "isCatchBegin": false, + "isTryBegin": false, + "isTryEnd": false, + "predecessors": [ + 0 + ], + "successors": [ + 4 + ] + }, + { + "id": 4, + "isCatchBegin": false, + "isTryBegin": false, + "isTryEnd": false, + "predecessors": [ + 2, + 1 + ] + } + ], + "name": "#15727984211755898705#", + "returnType": "any", + "signature": ".#15727984211755898705#" + }, + "name": "" + } + ] + } + ] +} \ No newline at end of file diff --git a/jacodb-panda-dynamic/src/test/resources/samples/taintSamples/SQLInjection3.ts b/jacodb-panda-dynamic/src/test/resources/samples/taintSamples/SQLInjection3.ts new file mode 100644 index 000000000..dfac2c4f5 --- /dev/null +++ b/jacodb-panda-dynamic/src/test/resources/samples/taintSamples/SQLInjection3.ts @@ -0,0 +1,37 @@ +import * as express from 'express'; +import * as mysql from 'mysql'; + +const app = express(); +const port = 3000; + +const connection = mysql.createConnection({ + host: 'localhost', + user: 'root', + password: '', + database: 'test_db' +}); + +connection.connect(err => { + if (err) { + console.error('Error connecting to database:', err); + return; + } + console.log('Connected to database'); +}); + +app.get('/user', (req, res) => { + const user = req.query.getUser(); + + const query = `SELECT * FROM users WHERE username = '${user}'`; + connection.query(query, (err, results) => { + if (err) { + res.status(500).send('Database query error'); + return; + } + res.json(results); + }); +}); + +app.listen(port, () => { + console.log(`Server is running on http://localhost:${port}`); +});