SSTI
Velocity
package com.example.controller;
import org.apache.velocity.VelocityContext;
import org.apache.velocity.app.Velocity;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import java.io.StringWriter;
@RestController
public class SstiController {
@RequestMapping("/ssti/velocity")
public String Velocity(@RequestParam(name = "content") String content) {
Velocity.init();
VelocityContext velocityContext = new VelocityContext();
velocityContext.put("username", "test");
StringWriter stringWriter = new StringWriter();
Velocity.evaluate(velocityContext, stringWriter, "test", content);
return stringWriter.toString();
}
}FreeMarker

最后更新于