-
Notifications
You must be signed in to change notification settings - Fork 649
/
xlsxStreamerXXE.java
43 lines (32 loc) · 1.14 KB
/
xlsxStreamerXXE.java
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
package org.joychou.controller.othervulns;
import com.monitorjbl.xlsx.StreamingReader;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.multipart.MultipartFile;
import java.io.FileInputStream;
import java.io.IOException;
/**
* Desc: xlsx-streamer xxe vuln code
* Usage: xl/workbook.xml
* Ref: https://www.itread01.com/hkpcyyp.html
* Fix: update xlsx-streamer to 2.1.0 or above
*
* @author JoyChou @2019-09-05
*/
@Controller
@RequestMapping("xlsx-streamer")
public class xlsxStreamerXXE {
@GetMapping("/upload")
public String index() {
return "xxe_upload"; // return xxe_upload.html page
}
@PostMapping("/readxlsx")
public void xllx_streamer_xxe(MultipartFile file) throws IOException {
StreamingReader.builder().open(file.getInputStream());
}
public static void main(String[] args) throws Exception {
StreamingReader.builder().open((new FileInputStream("poc.xlsx")));
}
}