-
Notifications
You must be signed in to change notification settings - Fork 2k
Expand file tree
/
Copy pathExposureInTransmittedData.cs
More file actions
42 lines (37 loc) · 1.01 KB
/
ExposureInTransmittedData.cs
File metadata and controls
42 lines (37 loc) · 1.01 KB
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
34
35
36
37
38
39
40
41
42
using System;
using System.Web;
using System.Data.Common;
using System.Net.Mail;
public class Handler : IHttpHandler
{
public void ProcessRequest(HttpContext ctx)
{
try
{
var password = "123456";
ctx.Response.Write(password); // BAD
}
catch (System.Data.SqlClient.SqlException ex)
{
ctx.Response.Write(ex.ToString()); // BAD
}
catch (DbException ex)
{
ctx.Response.Write(ex.Message); // BAD
ctx.Response.Write(ex.ToString()); // BAD
ctx.Response.Write(ex.Data["password"]); // BAD
}
}
void SendPasswordToEmail()
{
var p = GetField("password"); // p is now tainted
var message = new MailMessage("from", "to", p, p); // BAD
message.Body = "This is your password: " + p; // BAD
message.Subject = p; // BAD
}
string GetField(string field)
{
return "";
}
public bool IsReusable => true;
}