当前位置:网站首页>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 :

边栏推荐
- The CPU load caused by implicit conversion is nearly 100%
- 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
- 影刀RPA学习和遇见excel部分问题解决方式
- Méthodes couramment utilisées dans uniapp - TIMESTAMP et Rich Text Analysis picture
- 姿态估计之2D人体姿态估计 - SimDR: Is 2D Heatmap Representation Even Necessary for Human Pose Estimation?
- NanoMQ Newsletter 2022-05|v0.8.0 发布,新增 WebHook 拓展接口和连接认证 API
- 【無標題】
- 顺应医改,积极布局——集采背景下的高值医用耗材发展洞察2022
- leetcode:730. Statistics of different palindrome subsequences [traversed by point and surface interval DP + 3D DP + diagonal]
- [section 7 function]
猜你喜欢

硬件仪器的使用

Unified certification center oauth2 certification pit

姿态估计之2D人体姿态估计 - Numerical Coordinate Regression with Convolutional Neural Networks(DSNT)

The command set has reached strategic cooperation with Yingmin technology, and the domestic original Internet of things operating system has helped to make power detection "intelligent"

This and object prototypes

统一认证中心 Oauth2 认证坑

Smart home (3) competitive product analysis of Intelligent Interaction

MapReduce之Reduce阶段的join操作案例

You will never want to miss these vertical niche navigation websites

RK3308 按键Key与LED灯
随机推荐
Sorting of MapReduce cases
SQL language
Common sense: the number of neurons in the brain of mice is about 70million and that of humans is about 86billion
Jerry's long press reset and high level reset [chapter]
sm59远程连接,如果提示没有host,则在服务器上加上host,然后重启sap_SAP刘梦
Guanghetong cooperates with China Mobile, HP, MediaTek and Intel to build 5g fully connected PC pan terminal products
Apache atlas quick start
The command set has reached strategic cooperation with Yingmin technology, and the domestic original Internet of things operating system has helped to make power detection "intelligent"
What are the top ten futures companies with low handling fees? Is it safe?
MapReduce之分区案例的代码实现
排序与分页
Summary of methods for point projection onto a plane
Jerry's interface for obtaining ble broadcast package and profile data [chapter]
测试用例常用方法和选择原则
Opencv 4 handwriting recognition: perfect self built training set
[untitled]
Méthodes couramment utilisées dans uniapp - TIMESTAMP et Rich Text Analysis picture
直播預告 | 解構OLAP!新型多維分析架構範式全公開!Apache Doris 將帶來五個重磅議題!
NanoMQ Newsletter 2022-05|v0.8.0 发布,新增 WebHook 拓展接口和连接认证 API
Software test architects, 16 pieces of advice for future generations, take a look and don't miss it