Skip to content

Commit

Permalink
add
Browse files Browse the repository at this point in the history
  • Loading branch information
safe6Sec committed Oct 24, 2021
1 parent b07b0a8 commit 43a3706
Showing 1 changed file with 90 additions and 1 deletion.
91 changes: 90 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ codeql database upgrade database/javasec



### Method
### 过滤 Method

#### 根据Method name查询

Expand Down Expand Up @@ -132,6 +132,95 @@ select method



过滤 方法调用

### MethodAccess

一般是先查`method`,与`MethodAccess.getMethod()` 进行比较。

比如查`ContentTypeHandler``toObject()` 方法的调用。

```
import java
from MethodAccess call, Method method
where method.hasName("toObject") and method.getDeclaringType().getASupertype().hasQualifiedName("org.apache.struts2.rest.handler", "ContentTypeHandler") and call.getMethod() = method
select call
```

上面这种查询方式不行,只能查到`JsonLibHandler` 这样显式定义的。

怎么改进呢?

也可以使用`getAnAncestor()` 或者`getASupertype()*`

```
import java
from MethodAccess call, Method method
where method.hasName("toObject") and method.getDeclaringType().getAnAncestor().hasQualifiedName("org.apache.struts2.rest.handler", "ContentTypeHandler") and call.getMethod() = method
select call
```





# 数据流跟踪

数据流分析要继承`DataFlow::Configuration` 这个类,然后重载`isSource``isSink` 方法



```
class MyConfig extends DataFlow::Configuration {
MyConfig() { this = "Myconfig" }
override predicate isSource(DataFlow::Node source) {
....
}
override predicate isSink(DataFlow::Node sink) {
....
}
}
```



污点跟踪

污点跟踪分析要继承`TaintTracking::Configuration` 这个类,然后重载`isSource``isSink` 方法

```
class VulConfig extends TaintTracking::Configuration {
VulConfig() { this = "myConfig" }
override predicate isSource(DataFlow::Node source) {
}
override predicate isSink(DataFlow::Node sink) {
}
}
from VulConfig config, DataFlow::PathNode source, DataFlow::PathNode sink
where config.hasFlowPath(source, sink)
select sink.getNode(), source, sink, "source are"
```














Expand Down

0 comments on commit 43a3706

Please sign in to comment.