@@ -30,54 +30,38 @@ dbms.security.procedures.unrestricted=apoc.*,tabby.*
3030call tabby.help("tabby")
3131```
3232
33- #### findPath、findAllPaths
33+ #### released procedures
3434
3535``` cypher
36- tabby.algo.findPath(startNode, endNodes, maxNodeLength, isBackward, isDepthFirst) YIELD path, weight
37- tabby.algo.findPathWithState(startNode, endNodes, maxNodeLength, state, isDepthFirst) YIELD path, weight
38- tabby.algo.findAllPaths(startNodes, endNodes, maxNodeLength, isBackward, isDepthFirst) YIELD path, weight
36+ tabby.algo.findPath(source, direct, sink, maxNodeLength, isDepthFirst) YIELD path, weight
37+ tabby.algo.findPathWithState(source, direct, sink, sinkState, maxNodeLength, isDepthFirst) YIELD path, weight
38+ tabby.algo.findJavaGadget(source, direct, sink, maxNodeLength, isDepthFirst) YIELD path, weight
39+ tabby.algo.findJavaGadgetWithState(source, direct, sink, sinkState, maxNodeLength, isDepthFirst) YIELD path, weight
3940```
40- findPath 系列可指定前后向分析算法` isBackward ` ,也可指定路径检索算法(DFS、BFS)` isDepthFirst `
4141
42- 另外,findPathWithState 默认为后向分析算法, ` state ` 参数可用于指定sink函数的污点信息,类似 ` [0] `
42+ findPath 系列用于应用 tabby 生成的带污点的代码属性图,在遍历过程中不断剪枝,最终输出 n 条符合污点传播的路径。
4343
44- #### findJavaGadget、findAllJavaGadget
44+ findJavaGadget 系列用于查找 Java 原生反序列化利用链,在污点剪枝的基础上,同时判断当前函数所属的 class 是否实现了 Serializable 接口。
4545
46- ``` cypher
47- tabby.algo.findJavaGadget(source, sinks, maxNodeLength, isBackward, depthFirst) YIELD path, weight
48- tabby.algo.findAllJavaGadget(sources, sinks, maxNodeLength, isBackward, depthFirst) YIELD path, weight
49- ```
50- findJavaGadget 系列主要用于查找 Java 原生反序列化利用链
51-
52- #### beta procedures
53- ``` cypher
54- tabby.beta.findPath(source, direct, sink, maxNodeLength, isDepthFirst) YIELD path, weight
55- tabby.beta.findPathWithState(source, direct, sink, sinkState, maxNodeLength, isDepthFirst) YIELD path, weight
56- tabby.beta.findJavaGadget(source, direct, sink, maxNodeLength, isDepthFirst) YIELD path, weight
57- tabby.beta.findJavaGadgetWithState(source, direct, sink, sinkState, maxNodeLength, isDepthFirst) YIELD path, weight
58- ```
59- 为了能更好地利用内存 cache,不采用上述集合查询的方式,经测试比较,比采用集合的方式提效至少5倍
60- 但当前 procedure 仍在 beta 阶段,欢迎测试使用!
61-
62- 上述的几个 procedure,source 和 sink 节点的位置是固定的,不需要根据检索方向来调整位置。
63-
64- findPath 系列 direct 有3种:
46+ 另外,findPath 系列 direct 有3种:
6547- ">": 前向算法,从 source 开始查找至 sink
6648- "<": 后向算法,从 sink 开始查找至 source
6749- "-": 双向算法,分别从 source 和 sink 开始查找,找到聚合点后输出
6850
6951findJavaGadget 系列 direct 只支持前向和后向算法
7052
71- 其他参数同之前的用法一致,不再赘述。
72-
7353#### 通用语法
7454
7555通用的语法,更多的用法参考neo4j cypher语法
7656```
7757match (source:Method {NAME:"readObject"}) // 限定source
7858match (sink:Method {IS_SINK:true, NAME:"invoke"}) // 限定sink
79- with source, collect(sink) as sinks // 聚合sink
80- call tabby.algo.findJavaGadget(source, sinks, 8, false, false) yield path where none(n in nodes(path) where n.CLASSNAME in ["java.io.ObjectInputStream","org.apache.commons.beanutils.BeanMap","org.apache.commons.collections4.functors.PrototypeFactory$PrototypeCloneFactory"])
59+ call tabby.algo.findJavaGadget(source, ">", sink, 8, false) yield path
60+ where none(n in nodes(path) where
61+ n.CLASSNAME in [
62+ "java.io.ObjectInputStream",
63+ "org.apache.commons.beanutils.BeanMap",
64+ "org.apache.commons.collections4.functors.PrototypeFactory$PrototypeCloneFactory"])
8165return path limit 1
8266```
8367
@@ -96,6 +80,6 @@ Note: tricks:
9680
9781## #3 案例
9882
99- 见cyphers目录
83+ ~~ 见cyphers目录~~
10084
10185目前,查询结果基于tabby 2.0,暂未测试tabby 1.x
0 commit comments