Skip to content

Commit a7edccf

Browse files
committed
update
1 parent 9baace2 commit a7edccf

File tree

9 files changed

+241
-0
lines changed

9 files changed

+241
-0
lines changed

docs/0x00 基础知识/index.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
参考学习
2+
https://www.yuque.com/atguigu/springboot
3+
4+
官方文档
5+
https://docs.spring.io/spring-boot/docs/current/reference/html/
Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
package org.bewhale.javasec.controller;
2+
3+
import org.bewhale.javasec.model.Admin;
4+
import org.bewhale.javasec.service.AdminService;
5+
import org.springframework.beans.factory.annotation.Autowired;
6+
import org.springframework.stereotype.Controller;
7+
import org.springframework.web.bind.annotation.*;
8+
9+
@RequestMapping("/admin")
10+
@Controller
11+
public class AdminController {
12+
@GetMapping("")
13+
public String index() {
14+
return "admin/adminlogin";
15+
}
16+
17+
@Autowired
18+
@SuppressWarnings("all")
19+
AdminService adminService;
20+
21+
@ResponseBody
22+
@PostMapping("/login")
23+
public String login(@RequestParam(name="username", required =true) String username,
24+
@RequestParam(name="password", required = true) String password){
25+
26+
Admin admin = adminService.login(username, password);//调用service层抽象类方法,返回一个承接了数据库返回值的实体类
27+
if (admin != null) {//很简单的逻辑,返回的只要不是空值就说明是存在的,ok
28+
return "welcome adminster!" + admin;//返回一段文本
29+
}
30+
return "/err";//返回到另一个界面,但是目前还没做
31+
}
32+
}
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
package org.bewhale.javasec.dao;
2+
3+
import org.apache.ibatis.annotations.Mapper;
4+
import org.bewhale.javasec.model.Admin;
5+
6+
@Mapper
7+
public interface AdminDao {
8+
Admin login(String username, String password);
9+
}
Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
package org.bewhale.javasec.model;
2+
3+
import java.io.Serializable;
4+
5+
public class Admin implements Serializable {
6+
String id;
7+
String username;
8+
String password;
9+
10+
public String getId() {
11+
return id;
12+
}
13+
14+
public void setId(String id) {
15+
this.id = id;
16+
}
17+
18+
public String getUsername() {
19+
return username;
20+
}
21+
22+
public void setUsername(String username) {
23+
this.username = username;
24+
}
25+
26+
public String getPassword() {
27+
return password;
28+
}
29+
30+
public void setPassword(String password) {
31+
this.password = password;
32+
}
33+
}
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
package org.bewhale.javasec.service;
2+
3+
import org.bewhale.javasec.model.Admin;
4+
5+
public interface AdminService {
6+
Admin login(String username, String password);
7+
}
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
package org.bewhale.javasec.service.impl;
2+
3+
import org.bewhale.javasec.dao.AdminDao;
4+
import org.bewhale.javasec.model.Admin;
5+
import org.bewhale.javasec.service.AdminService;
6+
import org.springframework.beans.factory.annotation.Autowired;
7+
import org.springframework.stereotype.Service;
8+
9+
@Service
10+
public class AdminServiceImpl implements AdminService {
11+
@Autowired
12+
AdminDao adminDao;
13+
14+
@Override
15+
public Admin login(String username, String password) {
16+
Admin admin = adminDao.login(username, password);
17+
return admin;
18+
}
19+
}
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd" >
3+
<mapper namespace="org.bewhale.javasec.dao.AdminDao">
4+
<!-- //注意命名空间就是框架绑定的依据哈-->
5+
6+
<sql id="base_table">
7+
users
8+
-- //这是定义了一个属性,方便重复利用罢了
9+
</sql>
10+
<select id="login" resultType="org.bewhale.javasec.model.Admin">
11+
select * from
12+
<include refid="base_table" />
13+
where username=#{username,jdbcType=VARCHAR}
14+
-- //这就是简单的上个参数和在数据库里的类型,会自动调成实体类能接受的类型
15+
and
16+
password=#{password,jdbcType=VARCHAR}
17+
</select>
18+
<!-- //这就是核心部分了,id是说和抽象层哪一个方法绑定,返回值把实体类拉进来自动去绑,而且会根据数据库和实体类自动调整哦.-->
19+
</mapper>
Lines changed: 98 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,98 @@
1+
<!doctype html>
2+
3+
<html lang="en" xmlns:th="http://www.thymeleaf.org">
4+
<head>
5+
<meta charset="UTF-8">
6+
<title>Java漏洞靶场</title>
7+
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/[email protected]/dist/semantic.min.css">
8+
</head>
9+
<body>
10+
11+
<div style="padding: 40px;
12+
text-align: center;
13+
background: #1abc9c;
14+
color: white;">
15+
<h1>Java漏洞演示平台</h1>
16+
<button class="ui inverted secondary basic button"><a style="color: white" href="https://github.com/tangxiaofeng7/SecExample" target="_blank">靶机源码</a></button>
17+
</div>
18+
19+
20+
<div style="margin-top: 50px;margin-left: 25px;margin-right: 25px" class="ui cards">
21+
<div class="card">
22+
<div class="content">
23+
<div class="header">注入漏洞-SQL注入</div>
24+
<div class="description">SQL注入通过把SQL命令插入到Web表单提交或输入域名或页面请求的查询字符串,最终达到欺骗服务器执行指定的SQL语句</div>
25+
</div>
26+
<a class="ui bottom attached button" th:href="@{/sql}" ><i class="add icon"></i>测试漏洞</a>
27+
</div>
28+
29+
<div class="card">
30+
<div class="content">
31+
<div class="header">注入漏洞-命令注入</div>
32+
<div class="description">RCE (remote code execution):指用户通过浏览器提交执行命令,由于服务器端没有针对执行函数做过滤,导致在没有指定绝对路径的情况下就执行命令,可能会允许攻击者通过改变 $PATH 或程序执行环境的其他方面来执行一个恶意构造的代码。</div>
33+
</div>
34+
<a class="ui bottom attached button" th:href="@{/rce}" ><i class="add icon"></i>测试漏洞</a>
35+
</div>
36+
37+
<div class="card">
38+
<div class="content">
39+
<div class="header">注入漏洞-spel表达式注入</div>
40+
<div class="description">spel表达式注入 (Spring Expression Language):是一种功能强大的表达式语言,用于在运行时查询和操作对象图;语法上称为Unified EL,但提供了更多的特性,特别是方法调用和基本字符SpEL的生成是为了给Spring社区提供一种能够与Spring生态系统所有产品无缝对接,能提供一站式支持的表达式语言。</div>
41+
</div>
42+
<a class="ui bottom attached button" th:href="@{/spel}" ><i class="add icon"></i>测试漏洞</a>
43+
</div>
44+
<div class="card">
45+
<div class="content">
46+
<div class="header">XSS漏洞</div>
47+
<div class="description">XSS(Cross Site Scripting):跨站脚本攻击是指恶意攻击者往Web页面里插入恶意Script代码,当用户浏览该页之时,嵌入其中Web里面的Script代码会被执行,从而达到恶意攻击用户的目的</div>
48+
</div>
49+
<a class="ui bottom attached button" th:href="@{/xss}" ><i class="add icon"></i>测试漏洞</a>
50+
</div>
51+
52+
<div class="card">
53+
<div class="content">
54+
<div class="header">CSRF漏洞</div>
55+
<div class="description">CSRF(Cross-site request forgery):CSRF,跨站请求伪造,在受害者通过浏览器登录某个恶意URL的时候,通过伪造请求达到跨站请求伪造(常见于商城类网站或者自己开发的会员系统)</div>
56+
</div>
57+
<a class="ui bottom attached button" th:href="@{/csrf}" ><i class="add icon"></i>测试漏洞</a>
58+
</div>
59+
60+
<div class="card">
61+
<div class="content">
62+
<div class="header">SSRF漏洞</div>
63+
<div class="description">SSRF(Server-Side Request Forgery):服务器端请求伪造是一种由攻击者构造形成由服务端发起请求的一个安全漏洞。一般情况下,SSRF攻击的目标是从外网无法访问的内部系统。</div>
64+
</div>
65+
<a class="ui bottom attached button" th:href="@{/ssrf}" ><i class="add icon"></i>测试漏洞</a>
66+
</div>
67+
68+
<div class="card">
69+
<div class="content">
70+
<div class="header">CORS漏洞</div>
71+
<div class="description">CORS(Cross-origin resource sharing)。因为出于安全的考虑, 浏览器不允许Ajax调用当前源之外的资源.,即浏览器的同源策略,但一个请求url的协议、域名、端口三者之间任意一个与当前页面不同即为跨域、它允许阅览器向跨源服务器发送XMLHttpRequest请求,从而克服AJAX只能同源使用的限制</div>
72+
</div>
73+
<a class="ui bottom attached button" th:href="@{/cors1}" ><i class="add icon"></i>测试漏洞</a>
74+
</div>
75+
76+
<div class="card">
77+
<div class="content">
78+
<div class="header">反序列化漏洞-Fastjson反序列化</div>
79+
<div class="description">序列化和反序列化本身并不存在问题。但当输入的反序列化的数据可被用户控制,那么攻击者即可通过构造恶意输入,让反序列化产生非预期的对象,在此过程中执行构造的任意代码。</div>
80+
</div>
81+
<a class="ui bottom attached button" th:href="@{/fastjson}" ><i class="add icon"></i>测试漏洞</a>
82+
</div>
83+
84+
85+
86+
<div class="card">
87+
<div class="content">
88+
<div class="header">验证码相关漏洞</div>
89+
<div class="description">短信回显<br>短信轰炸<br>前端绕过验证<br>验证码爆破</div>
90+
</div>
91+
<a class="ui bottom attached button" th:href="@{/messageecho}" ><i class="add icon"></i>测试漏洞</a>
92+
</div>
93+
94+
</div>
95+
96+
97+
</body>
98+
</html>
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
<!DOCTYPE html>
2+
<html>
3+
<head>
4+
<meta charset="UTF-8">
5+
<title>administer,welcome to login Vanchip exam-online system!</title>
6+
</head>
7+
<body>
8+
<form method="post" action="admin/login">
9+
<label>welcome! administer!</label>
10+
<p>
11+
<input type="text" value="请输入您的账户" name="username" id="username">
12+
</p>
13+
<input type="text" value="请输入您的密码" name="password" id="password">
14+
<p>
15+
<input type="submit" value="登录" >
16+
</p>
17+
</form>
18+
</body>
19+
</html>

0 commit comments

Comments
 (0)