mirror of
https://github.com/github/codeql.git
synced 2026-07-16 00:38:15 +02:00
39 lines
990 B
C#
39 lines
990 B
C#
using System;
|
|
using System.Threading.Tasks;
|
|
using System.Web.Mvc;
|
|
using System.Net.Http;
|
|
|
|
namespace RequestForgery.Controllers
|
|
{
|
|
public class SSRFController : Controller
|
|
{
|
|
[HttpPost]
|
|
[ValidateAntiForgeryToken]
|
|
public async Task<ActionResult> Bad(string url) // $ Source=r1
|
|
{
|
|
var request = new HttpRequestMessage(HttpMethod.Get, url); // $ Alert=r1
|
|
|
|
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();
|
|
}
|
|
}
|
|
}
|