set folder=E:\code\tabby\cases\weblogic rem 设置目标目录 set targetDir=E:\code\tabby\cases\weblogic\directory rem 创建目标目录,如果它不存在 ifnotexist "%targetDir%" mkdir "%targetDir%" rem 切换到目标目录 cd /d "%targetDir%" rem 遍历当前目录下所有 .jar 文件 for%%Fin (%folder%\*.jar) do ( echo 正在解压 %%F... rem 使用 jar 解压 "E:\Download\java\bin\jar.exe" xf "%%F" )
echo 解压完成! pause
jar cf merged.jar -C directory_path .将directory_path下的jar包合成一个merged.jar
match (source:Method) where source.NAME in ["readObject"] and source.CLASSNAME="com.caucho.hessian.io.Hessian2Input" match (sink:Method {IS_SINK:true, NAME:"invoke"})<-[r:CALL]-(m1:Method) where r.REAL_CALL_TYPE in ["java.lang.reflect.Method"] CALL apoc.algo.allSimplePaths(m1, source ,"<CALL|ALIAS", 9) yield path return * limit 20
match (source:Method) where source.NAME in ["putVal"] and source.CLASSNAME="java.util.HashMap" match (sink:Method {IS_SINK:true, NAME:"invoke"})<-[r:CALL]-(m1:Method) where r.REAL_CALL_TYPE in ["java.lang.reflect.Method"] CALL apoc.algo.allSimplePaths(m1, source ,"<CALL|ALIAS", 9) yield path return * limit 1
ctf比赛找黑名单绕过
1 2 3 4
match (source:Method) where source.NAME in ["readObject"] and source.CLASSNAME="javax.activation.URLDataSource" match (sink:Method {NAME:"toString"})<-[r:CALL]-(m1:Method) call apoc.algo.allSimplePaths(m1, source, "<CALL|ALIAS", 6) yield path where none(n in nodes(path) where (n.CLASSNAME =~ "javax.management.*" or n.CLASSNAME =~ "com.alibaba.fastjson.*" )) return * limit 10
web层次找可能的未授权
1 2 3 4
MATCH (source:Method) WHERE source.NAME in ["doGet","doPost"] MATCH (sink:Method{NAME:"doUploadBrithdayCard"})<-[:CALL]-(m1:Method) CALL apoc.algo.allSimplePaths(m1, source ,"<CALL|ALIAS", 8) yield path RETURN * limit 20
from Constructor c //c是一个构造方法 //获取声明该构造方法的类类型, 检查这个构造方法是否是公共的 where c.getDeclaringType().getAMethod().isPublic() and isparam(c) and c.fromSource() and c.getName() != ""
classLookupMethodextendsCall{ LookupMethod() { this.getCallee().getDeclaringType().getASupertype*().hasQualifiedName("javax.naming", "Context") and this.getCallee().hasName("lookup") } }
classGetterCallableextendsCallable{ GetterCallable() { getName().matches("get%") and hasNoParameters() and getName().length() > 3 or getName().matches("set%") and getNumberOfParameters()= 1 } }
query predicate edges(Callable a, Callable b){ a.polyCalls(b) }
from LookupMethod endcall, GetterCallable entryPoint, Callable endCallAble where endcall.getCallee() = endCallAble and edges+(entryPoint, endCallAble) select endcall.getCaller(), entryPoint, endcall.getCaller(), "Geter jndi"