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

Commit

Permalink
Merge pull request #71 from joernio/niko/ignorelowercase
Browse files Browse the repository at this point in the history
Update DangerousFunctions.scala
  • Loading branch information
itsacoderepo authored Apr 3, 2021
2 parents 83019c4 + 73060ed commit f67fe02
Show file tree
Hide file tree
Showing 6 changed files with 15 additions and 14 deletions.
4 changes: 2 additions & 2 deletions src/main/scala/io/joern/scanners/c/CredentialDrop.scala
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ object CredentialDrop extends QueryBundle {
withStrRep({ cpg =>
// format: off
cpg.
method("set(res|re|e|)uid").
method("(?i)set(res|re|e|)uid").
callIn.
whereNot(_.dominatedBy.isCall.name("set(res|re|e|)?gid"))
// format: on
Expand All @@ -52,7 +52,7 @@ object CredentialDrop extends QueryBundle {
withStrRep({ cpg =>
// format: off
cpg.
method("set(res|re|e|)gid").
method("(?i)set(res|re|e|)gid").
callIn.
whereNot(_.dominatedBy.isCall.name("setgroups"))
// format: on
Expand Down
16 changes: 8 additions & 8 deletions src/main/scala/io/joern/scanners/c/DangerousFunctions.scala
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ object DangerousFunctions extends QueryBundle {
score = 8,
withStrRep({ cpg =>
// format: off
cpg.method("gets").callIn
cpg.method("(?i)gets").callIn
// format: on
}),
tags = List(QueryTags.badfn)
Expand All @@ -45,8 +45,8 @@ object DangerousFunctions extends QueryBundle {
score = 4,
withStrRep({ cpg =>
// format: off
val printfFns = cpg.method("printf").callIn.whereNot(_.argument.order(1).isLiteral)
val sprintsFns = cpg.method("(sprintf|vsprintf)").callIn.whereNot(_.argument.order(2).isLiteral)
val printfFns = cpg.method("(?i)printf").callIn.whereNot(_.argument.order(1).isLiteral)
val sprintsFns = cpg.method("(?i)(sprintf|vsprintf)").callIn.whereNot(_.argument.order(2).isLiteral)
(printfFns ++ sprintsFns)
// format: on
}),
Expand All @@ -67,7 +67,7 @@ object DangerousFunctions extends QueryBundle {
score = 4,
withStrRep({ cpg =>
// format: off
cpg.method("scanf").callIn
cpg.method("(?i)scanf").callIn
// format: on
}),
tags = List(QueryTags.badfn)
Expand All @@ -88,7 +88,7 @@ object DangerousFunctions extends QueryBundle {
score = 4,
withStrRep({ cpg =>
// format: off
cpg.method("(strcat|strncat)").callIn
cpg.method("(?i)(strcat|strncat)").callIn
// format: on
}),
tags = List(QueryTags.badfn)
Expand All @@ -111,7 +111,7 @@ object DangerousFunctions extends QueryBundle {
score = 4,
withStrRep({ cpg =>
// format: off
cpg.method("(strcpy|strncpy)").callIn
cpg.method("(?i)(strcpy|strncpy)").callIn
// format: on
}),
tags = List(QueryTags.badfn)
Expand All @@ -133,7 +133,7 @@ object DangerousFunctions extends QueryBundle {
score = 4,
withStrRep({ cpg =>
// format: off
cpg.method("strtok").callIn
cpg.method("(?i)strtok").callIn
// format: on
}),
tags = List(QueryTags.badfn)
Expand All @@ -153,7 +153,7 @@ object DangerousFunctions extends QueryBundle {
score = 4,
withStrRep({ cpg =>
// format: off
cpg.method("getwd").callIn
cpg.method("(?i)getwd").callIn
// format: on
}),
tags = List(QueryTags.badfn)
Expand Down
2 changes: 1 addition & 1 deletion src/main/scala/io/joern/scanners/c/HeapBasedOverflow.scala
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ object HeapBasedOverflow extends QueryBundle {
where(_.argument(1).arithmetics).l

cpg.
method("memcpy").
method("(?i)memcpy").
callIn.l.
filter { memcpyCall =>
memcpyCall.
Expand Down
3 changes: 2 additions & 1 deletion src/main/scala/io/joern/scanners/c/IntegerTruncations.scala
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,8 @@ object IntegerTruncations extends QueryBundle {
withStrRep({ cpg =>
// format: off
cpg.
method("strlen").
method.
name("(?i)strlen").
callIn.
inAssignment.
target.
Expand Down
2 changes: 1 addition & 1 deletion src/main/scala/io/joern/scanners/c/NullTermination.scala
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ object NullTermination extends QueryBundle {
// format: off
val allocations = cpg.method(".*malloc$").callIn.argument(1).l
cpg.
method("strncpy").
method("(?i)strncpy").
callIn.
map { c =>
(c.method, c.argument(1), c.argument(3))
Expand Down
2 changes: 1 addition & 1 deletion src/main/scala/io/joern/scanners/c/RetvalChecks.scala
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ object RetvalChecks extends QueryBundle {
// format: off
implicit val noResolve: NoResolve.type = NoResolve
val callsNotDirectlyChecked = cpg.
method("(read|recv|malloc)").
method("(?i)(read|recv|malloc)").
callIn.
filterNot { y =>
val code = y.code
Expand Down

0 comments on commit f67fe02

Please sign in to comment.