CRLF注入

package com.example.controller;

import org.springframework.http.HttpHeaders;
import org.springframework.http.HttpStatus;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

@RestController
public class UserController {

    @RequestMapping(value = "/crlf")
    public ResponseEntity<String> example(@RequestParam("name") String name) {
        String message = "Hello, " + name;
        HttpHeaders headers = new HttpHeaders();
        headers.set("Location", "https://example.com");
        headers.set("test",name);
        return new ResponseEntity<>(message, headers, HttpStatus.OK);
    }
}
image-20230314161742162

修复代码

image-20230314161849070

最后更新于

这有帮助吗?