diff --git a/README.md b/README.md index 82ab8c8..3b74a21 100644 --- a/README.md +++ b/README.md @@ -2,27 +2,28 @@
![SecExample](https://socialify.git.ci/tangxiaofeng7/SecExample/image?description=1&descriptionEditable=Vulnerability%20environment%20for%20Java&font=Raleway&forks=1&issues=1&pattern=Overlapping%20Hexagons&stargazers=1&theme=Dark) -Use secexample to study Web security vulnerabilities +JAVA 漏洞靶场
https://github.com/tangxiaofeng7/SecExample
-# Introduce +# 介绍 | Name | Star | | ---------------------- | ---- | -| [SQLI] | 🌟🌟 | -| [XSS] | 🌟 | -| [CSRF] | 🌟 | -| [SSRF] | 🌟🌟 | -| [CORS] | 🌟🌟 | -| [RCE] | 🌟🌟 | -| [Fastjson] | 🌟🌟🌟🌟 | -| [Verification] | 🌟🌟 | +| [注入漏洞-SQL注入] | 🌟🌟🌟 | +| [注入漏洞-命令注入] | 🌟 | +| [注入漏洞-spel表达式注入] | 🌟🌟🌟 | +| [XSS漏洞] | 🌟 | +| [CSRF漏洞] | 🌟🌟 | +| [SSRF漏洞] | 🌟🌟 | +| [CORS漏洞] | 🌟🌟🌟🌟 | +| [反序列化漏洞-Fastjson反序列化] | 🌟🌟🌟🌟 | +| [验证码相关漏洞] | 🌟🌟 | -### Installation +### 安装 ``` git clone https://github.com/tangxiaofeng7/SecExample.git @@ -30,16 +31,11 @@ cd SecExample docker-compose up -d ``` -view: http://localhost:8080 +访问: http://localhost:8080 [![asciicast](https://asciinema.org/a/gcuay3zNoRUZ85BTPgjpGukuC.svg)](https://asciinema.org/a/gcuay3zNoRUZ85BTPgjpGukuC) -### Screenshot +### 截图 ![index.png](images/index.png) - -# Contributors - - - diff --git a/images/index.png b/images/index.png index f88ae92..da5c0e1 100644 Binary files a/images/index.png and b/images/index.png differ diff --git a/src/main/java/com/suyu/secexample/rce/controller/rcecontroller.java b/src/main/java/com/suyu/secexample/rce/controller/rcecontroller.java index 4d02f02..2d9f07c 100644 --- a/src/main/java/com/suyu/secexample/rce/controller/rcecontroller.java +++ b/src/main/java/com/suyu/secexample/rce/controller/rcecontroller.java @@ -23,6 +23,9 @@ public String input(){ @PostMapping("/rceoutput") public String index(@RequestParam("command") String command, Model model){ + if(command=="" | command==null){ + command= "whoami"; + } Process p = null; String result = null; try { diff --git a/src/main/java/com/suyu/secexample/xxe/controller/xxecontroller.java b/src/main/java/com/suyu/secexample/xxe/controller/xxecontroller.java new file mode 100644 index 0000000..3ba80e7 --- /dev/null +++ b/src/main/java/com/suyu/secexample/xxe/controller/xxecontroller.java @@ -0,0 +1,14 @@ +package com.suyu.secexample.xxe.controller; + +import org.springframework.stereotype.Controller; +import org.springframework.web.bind.annotation.GetMapping; + +@Controller +public class xxecontroller { + + @GetMapping("/xxe") + public String input(){ + return "xxe/xxe"; + } + +} diff --git a/src/main/resources/application.yml b/src/main/resources/application.yml index dd566fc..acc8b07 100644 --- a/src/main/resources/application.yml +++ b/src/main/resources/application.yml @@ -2,8 +2,8 @@ spring: datasource: username: root password: woaini520 -# url: jdbc:mysql://localhost:3306/mybatis?serverTimezone=UTC&useSSL=false - url: jdbc:mysql://mysql-db:3306/mybatis?serverTimezone=UTC&useSSL=false&allowPublicKeyRetrieval=true + url: jdbc:mysql://localhost:3306/mybatis?serverTimezone=UTC&useSSL=false +# url: jdbc:mysql://mysql-db:3306/mybatis?serverTimezone=UTC&useSSL=false&allowPublicKeyRetrieval=true # driver-class-name: com.mysql.jdbc.Driver driver-class-name: com.mysql.cj.jdbc.Driver # thymeleaf: diff --git a/src/main/resources/templates/index.html b/src/main/resources/templates/index.html index a7fcc9a..e127e7a 100644 --- a/src/main/resources/templates/index.html +++ b/src/main/resources/templates/index.html @@ -24,7 +24,22 @@

Java漏洞演示平台

SQL注入通过把SQL命令插入到Web表单提交或输入域名或页面请求的查询字符串,最终达到欺骗服务器执行指定的SQL语句
测试漏洞 + +
+
+
注入漏洞-命令注入
+
RCE (remote code execution):指用户通过浏览器提交执行命令,由于服务器端没有针对执行函数做过滤,导致在没有指定绝对路径的情况下就执行命令,可能会允许攻击者通过改变 $PATH 或程序执行环境的其他方面来执行一个恶意构造的代码。
+
+ 测试漏洞 +
+ +
+
+
注入漏洞-spel表达式注入
+
spel表达式注入 (Spring Expression Language):是一种功能强大的表达式语言,用于在运行时查询和操作对象图;语法上称为Unified EL,但提供了更多的特性,特别是方法调用和基本字符SpEL的生成是为了给Spring社区提供一种能够与Spring生态系统所有产品无缝对接,能提供一站式支持的表达式语言。
+
+ 测试漏洞
@@ -32,41 +47,32 @@

Java漏洞演示平台

XSS(Cross Site Scripting):跨站脚本攻击是指恶意攻击者往Web页面里插入恶意Script代码,当用户浏览该页之时,嵌入其中Web里面的Script代码会被执行,从而达到恶意攻击用户的目的
测试漏洞 -
+
CSRF漏洞
CSRF(Cross-site request forgery):CSRF,跨站请求伪造,在受害者通过浏览器登录某个恶意URL的时候,通过伪造请求达到跨站请求伪造(常见于商城类网站或者自己开发的会员系统)
测试漏洞 -
+
SSRF漏洞
SSRF(Server-Side Request Forgery):服务器端请求伪造是一种由攻击者构造形成由服务端发起请求的一个安全漏洞。一般情况下,SSRF攻击的目标是从外网无法访问的内部系统。
测试漏洞 -
+
CORS漏洞
-
CORS(Cross-origin resource sharing)。因为出于安全的考虑, 浏览器不允许Ajax调用当前源之外的资源.,即浏览器的同源策略,但一个请求url的协议、域名、端口三者之间任意一个与当前页面不同即为跨域、它允许阅览器向跨源服务器发送XMLHttpRequest请求,从而克服AJAX只能同源使用的限制 -
+
CORS(Cross-origin resource sharing)。因为出于安全的考虑, 浏览器不允许Ajax调用当前源之外的资源.,即浏览器的同源策略,但一个请求url的协议、域名、端口三者之间任意一个与当前页面不同即为跨域、它允许阅览器向跨源服务器发送XMLHttpRequest请求,从而克服AJAX只能同源使用的限制
测试漏洞 -
-
-
-
RCE漏洞
-
RCE (remote code execution):指用户通过浏览器提交执行命令,由于服务器端没有针对执行函数做过滤,导致在没有指定绝对路径的情况下就执行命令,可能会允许攻击者通过改变 $PATH 或程序执行环境的其他方面来执行一个恶意构造的代码。
-
- 测试漏洞 -
反序列化漏洞-Fastjson反序列化
@@ -74,6 +80,9 @@

Java漏洞演示平台

测试漏洞
+ + +
验证码相关漏洞
@@ -81,6 +90,7 @@

Java漏洞演示平台

测试漏洞
+ diff --git a/src/main/resources/templates/spel/spel.html b/src/main/resources/templates/spel/spel.html new file mode 100644 index 0000000..10bf828 --- /dev/null +++ b/src/main/resources/templates/spel/spel.html @@ -0,0 +1,28 @@ + + + + + Java漏洞靶场 + + + + +
+

Java漏洞演示平台

+ +
+ +
+ + +

+

提示:T(java.lang.Runtime).getRuntime().exec('open -a Calculator.app')

+
+ + + + \ No newline at end of file diff --git a/src/main/resources/templates/spel/speloutput.html b/src/main/resources/templates/spel/speloutput.html new file mode 100644 index 0000000..717cdad --- /dev/null +++ b/src/main/resources/templates/spel/speloutput.html @@ -0,0 +1,22 @@ + + + + + Java漏洞靶场 + + + + +
+

Java漏洞演示平台

+ +
+
+您请求的结果为:

+
+ + diff --git a/src/main/resources/templates/ssrf/ssrfoutput.html b/src/main/resources/templates/ssrf/ssrfoutput.html index a168d7a..c2855e8 100644 --- a/src/main/resources/templates/ssrf/ssrfoutput.html +++ b/src/main/resources/templates/ssrf/ssrfoutput.html @@ -15,8 +15,9 @@

Java漏洞演示平台

- +
您请求的结果为:

- +