Skip to content

Commit

Permalink
Authent XML ++
Browse files Browse the repository at this point in the history
  • Loading branch information
Aif4thah committed May 20, 2024
1 parent 1c4cd90 commit 6c0c7ce
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
4 changes: 2 additions & 2 deletions Controller/Controller.cs
Original file line number Diff line number Diff line change
Expand Up @@ -82,11 +82,12 @@ On enregistre les objets "employé" valides dans un fichier en lecture seule
return Results.Ok($"File is : {File.GetAttributes(ROFile).ToString()} New id : {NewId} Empty Var: {HaveToBeEmpty.IsNullOrEmpty()}");
}

public static string VulnerableXmlParser(string Xml)
public static string VulnerableXmlParser(string Xml, string Token, string Secret)
{
/*
Parse les données XML passées en paramètre et retourne son contenu
*/
if (!VulnerableValidateToken(Token, Secret)) return Results.Unauthorized().ToString();
try
{
var Xsl = XDocument.Parse(Xml);
Expand All @@ -103,7 +104,6 @@ Parse les données XML passées en paramètre et retourne son contenu
}
catch (Exception ex)
{
Xml = Xml.Replace("Framework", "").Replace("Token", "").Replace("Cmd", "").Replace("powershell", "").Replace("http", "");
XmlReaderSettings ReaderSettings = new XmlReaderSettings();
ReaderSettings.DtdProcessing = DtdProcessing.Parse;
ReaderSettings.XmlResolver = new XmlUrlResolver();
Expand Down
2 changes: 1 addition & 1 deletion Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@

app.MapGet("/", async (string? lang) => await Task.FromResult(VLAController.VulnerableHelloWorld(HttpUtility.UrlDecode(lang)))).WithOpenApi();

Check warning on line 49 in Program.cs

View workflow job for this annotation

GitHub Actions / build

Possible null reference argument for parameter 'FileName' in 'object VLAController.VulnerableHelloWorld(string FileName = "english")'.

app.MapGet("/Xml", async (string i) => await Task.FromResult(VLAController.VulnerableXmlParser(HttpUtility.UrlDecode(i)))).WithOpenApi();
app.MapGet("/Xml", async (string i, string t) => await Task.FromResult(VLAController.VulnerableXmlParser(HttpUtility.UrlDecode(i), t, Secret))).WithOpenApi();

Check warning on line 51 in Program.cs

View workflow job for this annotation

GitHub Actions / build

Possible null reference argument for parameter 'Secret' in 'string VLAController.VulnerableXmlParser(string Xml, string Token, string Secret)'.

app.MapGet("/Json", async (string i, string t) => await Task.FromResult(VLAController.VulnerableDeserialize(HttpUtility.UrlDecode(i), t, Secret))).WithOpenApi();

Check warning on line 53 in Program.cs

View workflow job for this annotation

GitHub Actions / build

Possible null reference argument for parameter 'Secret' in 'object VLAController.VulnerableDeserialize(string Json, string Token, string Secret)'.

Expand Down

0 comments on commit 6c0c7ce

Please sign in to comment.