-
Notifications
You must be signed in to change notification settings - Fork 2k
Expand file tree
/
Copy pathRequestForgery.cs
More file actions
33 lines (28 loc) · 870 Bytes
/
RequestForgery.cs
File metadata and controls
33 lines (28 loc) · 870 Bytes
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
namespace RequestForgery.Controllers
{
public class SSRFController : Controller
{
[HttpPost]
[ValidateAntiForgeryToken]
public async Task<ActionResult> Bad(string url)
{
var request = new HttpRequestMessage(HttpMethod.Get, url);
var client = new HttpClient();
await client.SendAsync(request);
return View();
}
[HttpPost]
[ValidateAntiForgeryToken]
public async Task<ActionResult> Good(string url)
{
string baseUrl = "www.mysecuresite.com/";
if (url.StartsWith(baseUrl))
{
var request = new HttpRequestMessage(HttpMethod.Get, url);
var client = new HttpClient();
await client.SendAsync(request);
}
return View();
}
}
}