Update RequestForgeryBad.js

This commit is contained in:
Matt Rothenberg
2022-12-02 14:03:37 +01:00
committed by GitHub
parent 2ae0c7e115
commit a453405365

View File

@@ -1,8 +1,7 @@
import http from 'http';
import url from 'url';
var server = http.createServer(function(req, res) {
var target = url.parse(req.url, true).query.target;
const server = http.createServer(function(req, res) {
const target = new URL(req.url).searchParams.get("target");
// BAD: `target` is controlled by the attacker
http.get('https://' + target + ".example.com/data/", res => {