-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
v1ll4n
committed
Jul 22, 2024
1 parent
fb40ed8
commit b0dfa56
Showing
26 changed files
with
212 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
noDeepCross5 as $entry; | ||
$entry(*?{!have: this && opcode: param} as $params) | ||
|
||
$params --> as $sink; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
desc( | ||
title: 'checking [XSS Directly from Springboot Controller Params]', | ||
type: vuln | ||
) | ||
|
||
*Mapping.__ref__(*?{opcode: param && !have: this} as $params); | ||
check $params; | ||
$params <getFunc> as $sink; | ||
check $sink; | ||
$sink?{any: '.ok', '.body', 'ResponseEntity'} as $output; | ||
check $output; | ||
alert $output; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
desc( | ||
title: 'checking [XSS Filter from Springboot Controller Params]', | ||
type: audit | ||
) | ||
|
||
*Mapping.__ref__(*?{opcode: param && !have: this} as $params); | ||
check $params; | ||
|
||
$params -{until: `* <getFunc> ?{ any: /(?i).*xss.*/, /(?i).*filter.*/, /(?i).*escape.*/, /(?i).*encodexss.*/, /(?i).*xss.*?encode.*/, filterXSS } as $filter`}-> *; | ||
check $filter; | ||
|
||
$filter() -{hook: `*?{any: '.ok', '.body', 'ResponseEntity' && !opcode: param} as $sink` }-> *; | ||
check $sink |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
desc( | ||
title: 'checking [XSS Weak Handler from Springboot Controller Params]', | ||
type: vuln | ||
) | ||
|
||
*Mapping.__ref__(*?{opcode: param && !have: this} as $params); | ||
check $params; | ||
$params -{hook: `*<getFunc>?{!any: /(?i)((xss)|(filter)|(escape))/} as $filter`}-> <getFunc> as $sink; | ||
check $sink; | ||
$sink?{any: '.ok', '.body', 'ResponseEntity'} as $output; | ||
check $output; | ||
alert $output; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Binary file modified
BIN
+387 Bytes
(130%)
java-realworld/sample/bin/src/main/java/com/example/demo/DemoApplication.class
Binary file not shown.
Binary file added
BIN
+1.2 KB
java-realworld/sample/bin/src/main/java/com/example/demo/controller/HelloController.class
Binary file not shown.
Binary file added
BIN
+2.35 KB
java-realworld/sample/bin/src/main/java/com/example/demo/controller/UserController.class
Binary file not shown.
Binary file added
BIN
+7.54 KB
.../sample/bin/src/main/java/com/example/demo/controller/deepcross/DeepCrossController.class
Binary file not shown.
Binary file added
BIN
+2.03 KB
...e/bin/src/main/java/com/example/demo/controller/fastjsondemo/FastJSONDemoController.class
Binary file not shown.
Binary file added
BIN
+4.43 KB
...ld/sample/bin/src/main/java/com/example/demo/controller/freemakerdemo/FreeMakerDemo.class
Binary file not shown.
9 changes: 9 additions & 0 deletions
9
...ld/sample/bin/src/main/java/com/example/demo/controller/freemakerdemo/README.md
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
# Java Freemaker | ||
|
||
使用 Springboot Freemaker Starter 启动后,在 Controller Method 中,返回一个 String 则为 freemaker template 的模版名称(文件名)。 | ||
|
||
找到文件名比较关键。 | ||
|
||
一般作为一个 Controller 来说,他的方法是一个纯 Literal String,例如为 $ret,则需要在数据库中搜索 f`${ret}\.\w+` 类似的文件存在,一般来说这个文件中的 ${...} 是可以供 SSTI 的点。 | ||
|
||
一般的模版注入的审计都类似这种情况,Java 中出现裸 TPL 的渲染和调用的机会不多,框架会包裹一系列的用法。 |
Binary file added
BIN
+2.28 KB
.../sample/bin/src/main/java/com/example/demo/controller/global/GlobalExceptionHandler.class
Binary file not shown.
Binary file added
BIN
+1.99 KB
java-realworld/sample/bin/src/main/java/com/example/demo/controller/utils/DBUtil.class
Binary file not shown.
Binary file added
BIN
+1.15 KB
java-realworld/sample/bin/src/main/java/com/example/demo/controller/utils/DummyUtil.class
Binary file not shown.
Binary file added
BIN
+970 Bytes
java-realworld/sample/bin/src/main/java/com/example/demo/mapper/UserMapper.class
Binary file not shown.
Binary file added
BIN
+2.03 KB
java-realworld/sample/bin/src/main/java/com/example/demo/model/UserModel.class
Binary file not shown.
18 changes: 18 additions & 0 deletions
18
java-realworld/sample/bin/src/main/resources/application.properties
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,19 @@ | ||
spring.application.name=demo | ||
|
||
# SQLite ????? | ||
spring.datasource.url=jdbc:sqlite:database.db | ||
spring.datasource.driver-class-name=org.sqlite.JDBC | ||
spring.jpa.database-platform=org.hibernate.dialect.SQLiteDialect | ||
|
||
# sqlmap mapper | ||
mybatis.mapper-locations=classpath:mapper/*.xml | ||
mybatis.type-aliases-package=com.example.demo.model | ||
|
||
# freemaker | ||
spring.freemarker.template-loader-path=classpath:/templates/ | ||
spring.freemarker.suffix=.ftl | ||
|
||
# auto update | ||
spring.jpa.hibernate.ddl-auto=update | ||
|
||
spring.sql.init.mode=always |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
INSERT INTO users (name, age) | ||
VALUES ('Alice', 25); | ||
|
||
INSERT INTO users (name, age) | ||
VALUES ('Bob', 30); | ||
|
||
INSERT INTO users (name, age) | ||
VALUES ('Charlie', 35); |
15 changes: 15 additions & 0 deletions
15
java-realworld/sample/bin/src/main/resources/mapper/UserMapper.xml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
<?xml version="1.0" encoding="UTF-8" ?> | ||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> | ||
<mapper namespace="com.example.demo.mapper.UserMapper"> | ||
|
||
<insert id="insertUser" parameterType="com.example.demo.model.UserModel"> | ||
INSERT INTO users (name, age) | ||
VALUES (#{name}, #{age}) | ||
</insert> | ||
|
||
<select id="findAllUsers" resultType="com.example.demo.model.UserModel"> | ||
SELECT id, name, age | ||
FROM users | ||
</select> | ||
|
||
</mapper> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
CREATE TABLE IF NOT EXISTS users | ||
( | ||
id | ||
INTEGER | ||
PRIMARY | ||
KEY | ||
AUTOINCREMENT, | ||
name | ||
TEXT | ||
NOT | ||
NULL, | ||
age | ||
INTEGER | ||
); |
9 changes: 9 additions & 0 deletions
9
java-realworld/sample/bin/src/main/resources/templates/no-return-template.ftl
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
<!DOCTYPE html> | ||
<html> | ||
<head> | ||
<title>Welcome</title> | ||
</head> | ||
<body> | ||
<h1>Welcome ${name}! If you see this, this is loaded by freemarkerConfig, not Controller Method Return</h1> | ||
</body> | ||
</html> |
9 changes: 9 additions & 0 deletions
9
java-realworld/sample/bin/src/main/resources/templates/welcome-safe.ftl
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
<!DOCTYPE html> | ||
<html> | ||
<head> | ||
<title>Welcome</title> | ||
</head> | ||
<body> | ||
<h1>Welcome ${name?html}!</h1> | ||
</body> | ||
</html> |
9 changes: 9 additions & 0 deletions
9
java-realworld/sample/bin/src/main/resources/templates/welcome.ftl
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
<!DOCTYPE html> | ||
<html> | ||
<head> | ||
<title>Welcome</title> | ||
</head> | ||
<body> | ||
<h1>Welcome ${name}!</h1> | ||
</body> | ||
</html> |
9 changes: 9 additions & 0 deletions
9
java-realworld/sample/bin/src/main/resources/templates/welcome2.ftl
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
<!DOCTYPE html> | ||
<html> | ||
<head> | ||
<title>Welcome</title> | ||
</head> | ||
<body> | ||
<h1>Welcome ${defaultName}!</h1> | ||
</body> | ||
</html> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters