Devouring Security: Marudhamaran Gunasekaran Dot Net Bangalore 3 Meet Up May 16 2015 at Prowareness, Bangalore
Devouring Security: Marudhamaran Gunasekaran Dot Net Bangalore 3 Meet Up May 16 2015 at Prowareness, Bangalore
mode=“RemoteOnly” is default
redirectMode=“responseRedirect” is default
Information Disclosure problems
<system.webServer>
<httpProtocol>
<customHeaders>
<remove name="X-Powered-By" />
</customHeaders>
</httpProtocol>
</system.webServer>
ASP.NET Tracing Vulnerabilites
Secure <trace> configurations
<trace enabled="true" localOnly="false"/>
<configuration>
<system.web>
<deployment retail=”true”/>
</system.web>
</configuration>
At
%windir%\Microsoft.Net\Framework64\v4.0.30319\Config
\machine.config
- Disables debugging
- Switches on Custom errors
- Disables tracing
Vulnerable session is in the URL
Secure <sessionState> configurations
<sessionState cookieless="UseUri"
<sessionState
cookieless="UseCookies" (default)
Secure <sessionState> configurations
Default cookie name obfuscation
<sessionState cookieName="_umt_"/>
Secure <httpCookies> configurations
<httpCookies httpOnlyCookies
="true" requireSSL="true"/>
@data
Auth(en) & Auth(or) with <location>
<location path="Administration.aspx">
<system.web>
<authorization>
<allow
roles="Administrators"/>
<deny users="*"/>
</authorization>
</system.web>
</location>
Authorization in ASP.NET MVC
[Authorize(Roles="Administrators")]
public ActionResult Index()
{}
Sample Login Page in ASP.NET MVC
[HttpPost]
[RequireHttps]
[AllowAnonymous]
[ValidateInput(true)]
[ValidateAntiForgeryToken]
public ActionResult Login(LoginModel model, string
returnUrl)
http://www.thetechherald.com/articles/CSRF-bug-on-INGDirect-com-could-have-allowed-fraudulent-transfers
�We discovered CSRF vulnerabilities in ING�s site that allowed an attacker to
open additional accounts on behalf of a user and transfer funds from a user�s
account to the attacker�s account,� the research paper noted, adding that SSL
did nothing to prevent the attack. �Since ING did not explicitly protect against
CSRF attacks, transferring funds from a user�s accounts was as simple as
mimicking the steps a user would take when transferring funds.�
Cross-Site Request Forgeries: Exploitation and Prevention
by William Zeller and Edward W. Felten
http://www.cs.utexas.edu/~shmat/courses/cs378_spring09/zeller.pdf
Sample: CSRF protection in TFS web
interface
CSRF Mitigation in ASP.Net MVC
Login.cshtml
LoginController.cs
CSRF Mitigation in ASP.Net MVC
• Adds a html hidden field named
__RequestVerificationToken
• X-XSS-Protection: 1
X-FRAME-OPTIONS
https://www.owasp.org/index.php/Clickjacking_
Defense_Cheat_Sheet#Browser_Support
Strict-Transport-Security
https://www.owasp.org/index.php/HTTP_Strict_Transport_Security#Browser_Support
Adding necessary response headers
<system.webServer>
<httpProtocol>
<customHeaders>
<add name="X-Frame-Options" value="DENY" />
<add name="X-XSS-Protection" value="1; mode=block" />
<add name="Strict-Transport-Security" value="max-age=31536000" />
</customHeaders>
</httpProtocol>
</system.webServer>
View State Security
<pages enableEventValidation="true"
enableViewStateMac="true"
viewStateEncryptionMode="Always" />
https://twitter.com/gmaran23
https://www.owasp.org/index.php/List_of_useful_HTTP_headers
https://www.owasp.org/index.php/OWASP_Zed_Attack_Proxy_Project
https://www.owasp.org/index.php/Category:OWASP_Top_Ten_Project
1. https://renouncedthoughts.wordpress.com/2014/01/14/devouring-security-sql-
injection-exploitation-and-prevention-part-1/
2. https://renouncedthoughts.wordpress.com/2014/02/07/devouring-security-sql-
injection-exploitation-and-prevention-part-2/
3. https://renouncedthoughts.wordpress.com/2014/05/09/sql-injection-testing-
for-qa-testers/
4. https://renouncedthoughts.wordpress.com/2014/05/09/devouring-security-xml-
attack-surface-and-defenses/
5. https://renouncedthoughts.wordpress.com/2014/09/26/devouring-security-
cross-site-scripting-xss/
6. https://renouncedthoughts.wordpress.com/2015/05/20/practical-security-
testing-for-developers-using-owasp-zap-at-dot-net-bangalore-3rd-meet-up-on-
feb-21-2015/