当前位置:网站首页>Software College of Shandong University Project Training - Innovation Training - network security range experimental platform (16)
Software College of Shandong University Project Training - Innovation Training - network security range experimental platform (16)
2022-06-10 16:17:00 【Scrambled eggs with tomatoes without eggs!】
Catalog
One 、 What is a directory traversal vulnerability ?
Two 、 The backend implementation
3、 ... and 、 The front-end code
Preface : This blog mainly records the implementation of directory traversal vulnerability .
One 、 What is a directory traversal vulnerability ?
Directory traversal ( Also known as file path traversal ) It's a Web Security vulnerabilities , It allows an attacker to read arbitrary files on the server where the application is running . This may include application code and data , Back end system credentials and sensitive operating system files . In some cases , An attacker may be able to write to arbitrary files on the server , This allows them to modify application data or behavior , And ultimately take full control of the server .
The directory traversal I do is for image browsing , And the browse file is encrypted first and then displayed . It increases the difficulty of making questions .
And will flag Write picture , For the questioner to find .
Two 、 The backend implementation
The back-end code is as follows :
@RestController
public class PathTravelController {
@Autowired
DataSource dataSource;
public String sql;
@RequestMapping("/pathtravel")
public Result pathtravel(@RequestParam("username") String username)
throws IOException {
// obtain BufferedImage object
BufferedImage image = createImage(flag);
File file = new File("vue/src/assets/img/bugimg/pathtravel/flag");
String fileName = "flag.jpg";
File jpgFile = new File(file,fileName);
if(!jpgFile.exists()) {
jpgFile.createNewFile();
}
// Create a picture output stream object , Based on file objects
ImageOutputStream imageOutputStream = ImageIO.createImageOutputStream(jpgFile);
// write in
ImageIO.write(image,"jpg",imageOutputStream);
// Closed flow
imageOutputStream.close();
System.out.println(" Picture writing complete , Please check out !");
}
rs.close();
connection.close();
} catch (SQLException e) {
System.out.println(" Wrong input , Database query error in flag");
System.out.println(e.toString());
//return " Wrong input , Database query error ";
}
return Result.success();
}
}Convert string to BufferedImage object
The code to write the string to the picture is as follows :
/*
* @description: Convert string to BufferedImage object
* @param: [strs]
* @return: java.awt.image.BufferedImage
* @author: fzj
* @date: 2022/6/02 21:20
*/
public static BufferedImage createImage(String str) {
// Set the width and height of the background
int width = 1000, height = 400;
BufferedImage image = new BufferedImage(width, height, BufferedImage.TYPE_INT_RGB);
// Get the graphic context object
Graphics graphics = image.getGraphics();
// fill
graphics.fillRect(0, 0, width, height);
// Set font size and style
graphics.setFont(new Font(" Song style ", Font.BOLD,34));
// The font color
graphics.setColor(Color.BLUE);
// Draw string
graphics.drawString(str, 100, 100 );
graphics.dispose();
return image;
}3、 ... and 、 The front-end code
front end Vue The interface code is as follows :
<template>
<div class="building">
<div class="menu">
<el-row>
<!-- Button menu section -->
<el-col :span="24">
<el-menu
:default-active="mypath"
class="el-menu-demo"
mode="horizontal"
background-color="#fff"
text-color="#000"
active-text-color="#FF9912"
@select="handleSelect"
>
<el-menu-item index="/honeypot"> </el-menu-item>
<el-menu-item index="/abilitypromotion"></el-menu-item>
<el-menu-item index="/forum" ></el-menu-item>
<el-menu-item index="/navigation" > scenery </el-menu-item>
<el-menu-item index="/coursemanagement" > food </el-menu-item>
<el-menu-item index="/usermanagement" > animal </el-menu-item>
<el-menu-item index="/usermanagement" > figure </el-menu-item>
<el-menu-item index="/usermanagement" > Architecture </el-menu-item>
<el-menu-item index="/usermanagement" > Ranking </el-menu-item>
</el-menu>
</el-col>
</el-row>
</div>
<div style="">
<el-row style="">
<el-col :span="8">
<el-card class="card" id="img1" @click="goto('img1.jpg')">
<p style="font-size: 25px;text-align: right;background-color:gray;width:150px;margin-left: 250px;margin-top: 280px;">
Check the details
<i class="el-icon-right" style=""></i>
</p>
</el-card>
</el-col>
<el-col :span="8">
<el-card class="card" id="img2" @click="goto('img2.jpg')">
<p style="font-size: 25px;text-align: right;background-color:gray;width:150px;margin-left: 250px;margin-top: 280px;">
Check the details
<i class="el-icon-right" style=""></i>
</p>
</el-card>
</el-col>
<el-col :span="8">
<el-card class="card" id="img3" @click="goto('img3.jpg')">
<p style="font-size: 25px;text-align: right;background-color:gray;width:150px;margin-left: 250px;margin-top: 280px;">
Check the details
<i class="el-icon-right" style=""></i>
</p>
</el-card>
</el-col>
</el-row>
</div>
<div style="">
<el-row style="">
<el-col :span="8">
<el-card class="card" id="img4" @click="goto('img4.jpg')">
<p style="font-size: 25px;text-align: right;background-color:gray;width:150px;margin-left: 250px;margin-top: 280px;">
Check the details
<i class="el-icon-right" style=""></i>
</p>
</el-card>
</el-col>
<el-col :span="8">
<el-card class="card" id="img5" @click="goto('img5.jpg')">
<p style="font-size: 25px;text-align: right;background-color:gray;width:150px;margin-left: 250px;margin-top: 280px;">
Check the details
<i class="el-icon-right" style=""></i>
</p>
</el-card>
</el-col>
<el-col :span="8">
<el-card class="card" id="img6" @click="goto('img6.jpg')">
<p style="font-size: 25px;text-align: right;background-color:gray;width:150px;margin-left: 250px;margin-top: 280px;">
Check the details
<i class="el-icon-right" style=""></i>
</p>
</el-card>
</el-col>
</el-row>
</div>
</div>
</template>Four 、 design sketch
In order to avoid showing the steps of doing questions , Only the range interface is shown below :

边栏推荐
- How does the wireless communication module help the intelligent UAV build the "Internet of things in the air"?
- Jerry's long press reset and high level reset [chapter]
- Duyuan outdoor sprint to Shenzhen Stock Exchange: the annual revenue is 350million, and the color of Lin Xizhen family is obvious
- LocalDate与Date相互转换
- Detailed explanation of RGB color space, hue, saturation, brightness and HSV color space
- Driver development and abnormal analysis of "technical dry goods" industrial touch screen (serial)
- Server operation and maintenance environment security system (Part 2)
- MapReduce之分区案例的代码实现
- Common methods and selection principles of test cases
- torch. utils. data. Dataloader() details [pytoch getting started manual]
猜你喜欢

MapReduce之Word Count案例代码实现

I used Matlab to reproduce the trembling sonic boom Fire Games Apple snake

Sm59 remote connection. If you are prompted that there is no host, add host to the server and restart SAP_ SAP LIUMENG
![Jerry's long press reset and high level reset [chapter]](/img/08/900aba6e419cda2f00c3f289ad615e.png)
Jerry's long press reset and high level reset [chapter]

Duyuan outdoor sprint to Shenzhen Stock Exchange: the annual revenue is 350million, and the color of Lin Xizhen family is obvious

Methods commonly used in uniapp (part) - timestamp problem and rich text parsing image problem

RK3308 按键Key与LED灯

Anba cv2fs/cv22fs obtained ASIL C chip function safety certification, surpassing the level of similar chips in the market

【MySQL基础】

RGB颜色空间、色调、饱和度、亮度、HSV颜色空间详解
随机推荐
剑指 Offer 06. 从尾到头打印链表
Apache atlas quick start
kubernetes 二进制安装(v1.20.16)(五)验证 master 部署
leetcode:730. Statistics of different palindrome subsequences [traversed by point and surface interval DP + 3D DP + diagonal]
uniapp中常用到的方法(部分) - 时间戳问题及富文本解析图片问题
姿态估计之2D人体姿态估计 - Numerical Coordinate Regression with Convolutional Neural Networks(DSNT)
Summary of methods for point projection onto a plane
Sm59 remote connection. If you are prompted that there is no host, add host to the server and restart SAP_ SAP LIUMENG
排序与分页
[sans titre]
Diagram of the quarterly report of station B: the revenue is RMB 5.1 billion, with a year-on-year increase of 30% and nearly 300million monthly active users
Smart home (3) competitive product analysis of Intelligent Interaction
Troubleshooting of cl210openstack operation -- troubleshooting of common core problems
袋鼠云数栈基于CBO在Spark SQL优化上的探索
json.load(s)与json.dump(s)
Server operation and maintenance environment security system (Part 2)
服务器运维环境安全体系(下篇)
The CPU load caused by implicit conversion is nearly 100%
【对象】。
Unified certification center oauth2 certification pit