Skip to content
This repository was archived by the owner on Oct 27, 2021. It is now read-only.

Commit

Permalink
Merge pull request #113 from joernio/claudiu/reenable-ghidra-query-tests
Browse files Browse the repository at this point in the history
Re-enable test suite for ghidra query bundle
  • Loading branch information
ursachec authored Oct 16, 2021
2 parents b718695 + 36529f2 commit f18ddaf
Show file tree
Hide file tree
Showing 2 changed files with 0 additions and 31 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -11,25 +11,6 @@ object UserInputIntoDangerousFunctions extends QueryBundle {

implicit val resolver: ICallResolver = NoResolve

@q
def mainArgsToStrcpy()(implicit context: EngineContext): Query =
Query.make(
name = "main-args-to-strcpy",
author = Crew.claudiu,
title = "`main` fn arguments used in strcpy source buffer",
description =
"""
|User-input ends up in source buffer argument of strcpy, which might overflow the destination buffer.
|""".stripMargin,
score = 4,
withStrRep({ cpg =>
def source = cpg.method.fullName("main").parameter
def sink = cpg.method.fullName("strcpy").parameter.index(2)
sink.reachableBy(source).l
}),
tags = List(QueryTags.badfn)
)

@q
def getenvToStrcpy()(implicit context: EngineContext): Query =
Query.make(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,21 +3,9 @@ package io.joern.scanners.ghidra
import io.joern.suites.GhidraQueryTestSuite
import org.scalatest.Ignore

@Ignore
class UserInputIntoDangerousFunctionsTests extends GhidraQueryTestSuite {
override def queryBundle = UserInputIntoDangerousFunctions

"mainArgsToStrcpy query" when {
def query = queryBundle.mainArgsToStrcpy()
"executed on CPG for binary with dataflow between `main` fn args and `strcpy` source argument" should {
"find the `main` function among the tracking points returned" in {
buildCpgForBin("buf1.exe")
val results = methodNamesForMatchedPoints(query)
results shouldBe Set("main")
}
}
}

"getenvToStrcpy query" when {
def query = queryBundle.getenvToStrcpy()

Expand Down

0 comments on commit f18ddaf

Please sign in to comment.