SlideShare a Scribd company logo
1 of 236
C# Web Security Class October 27, 2010
Introduction ,[object Object]
Time:   8:30 AM – 4:00 PM
Lunch Break: 11:30 – 12:30 P.M.
See http://oitplaza.colorado.gov:8080/oitplaza/how-to/security-training for some sample classes.
My personal website that contains some slides at http://www.s3curitys0lutions.com/
Introductions, locations of facilities
My background http://www.linkedin.com/pub/rich-helton/4/266/9a8
My email rich.helton@state.co.us,[object Object]
Only test a system with express written permission from the owner.,[object Object]
http://www.codeproject.com/
http://www.c-sharpcorner.com/
Microsoft Downloads:
http://www.asp.net/downloads (SQL Express, VS Express)
http://www.asp.net/ajaxlibrary/act.ashx (Ajax Toolkit)
http://www.microsoft.com/express/Web/ (VS 2010 Web Express)
http://www.microsoft.com/express/Downloads/  (VS 2010 C# Express) ,[object Object]
Web Attacks are the most common (from the 2010 ArcSight survey)
There are many hacks…. ,[object Object],Injection Flaws Cross Site Scripting (XSS) Broken Authentication and Session Management Insecure Direct Object  Reference Cross Site Request Forgery (CSRF) Security Misconfiguration Insecure Cryptographic Storage Failure to Restrict URL Access Insufficient Transport Layer Protection Unvalidated Redirects and Forwards
SANs 2010 Top Cyber Security Risks
There are many Checklists…. ,[object Object]
The ASP.NET Security Checklist http://msdn.microsoft.com/en-us/library/ff648269.aspx
WebAppSec Excel checklist http://img.a4apphack.com/dl/appsecchck-checklist.zip
SANs reading Web Security Checklist http://www.sans.org/reading_room/whitepapers/securecode/security-checklist-web-application-design_1389
The Open Web Application Security Project Application checklist is http://www.sans.org/reading_room/whitepapers/securecode/security-checklist-web-application-design_1389,[object Object]
Find and validate all input. This includes URL’s, JavaScript's, links, username and passwords, and especially any field calling a database.
Never trust data in files, the network or database to be secure. Encrypt anything important, passwords, SSN’s, configurations.
Never trust the source, be it customer or a service.  Authenticate, Authorize and validate.
Whenever a abnormal behavior occurs, error check and log.
Keep testing, as people from all skills will be testing anything on line and may try common threats. ,[object Object]
Spiders, Bots, and Crawlers! Oh my... ,[object Object]
They are bots (automated scanners) from Virus vendors, Security organizations, search engines and more cataloging all web sites.
There is the famous GoogleBot, http://en.wikipedia.org/wiki/Googlebot, that will look for the local robots.txt, see http://www.robotstxt.org/ , to define what to search for on the web site.  Hackers usually don’t respect these gentlemen agreements on the Internet.
There are so many scans on the Internet that many consider it white noise and careers have been built dedicated on sifting through the network traffics white noise.
Hackers specializing in Google API’s (Google Hacking), search for hidden files, like etc/passwd, pdf’s, job announcements and more to define the web site coding. ,[object Object]
Google Hacking ,[object Object]
A well known site containing a database of various keywords is found at http://www.hackersforcharity.org/ghdb/ .
For example, “ext:asp” can be used to find pages ending in asp.
For example,“ Hacking filetype:pdf” can be used to find PDFs that are about hacking.
For example, “restaurants inanchor:menu” will find restaurants with menu links in them.
intitle:index.of "web hacking”,[object Object],[object Object],[object Object]
Going beyond Google ,[object Object],[object Object]
Web sites watching Web sites…. ,[object Object],[object Object]
Just because you changed the web site, doesn’t mean it went away, see www.archive.org,
Wget (Open Source Web downloaders) ,[object Object],[object Object],[object Object]
Practicing the Web Hack…. ,[object Object]
Some download applications to practice web hacking locally are:
OWASP WebGoat (JSPs/Servlets) -http://www.owasp.org/index.php/OWASP_WebGoat_Project
Hackme Bank (.Net) - http://www.foundstone.com/us/resources/proddesc/hacmebank.htm
Hackme Books (JSPs/Servlets) –http://www.foundstone.com/us/resources/proddesc/hacmebooks.htm
SecuriBench (Java Code) – http://suif.stanford.edu/~livshits/securibench/
Live sites… ,[object Object]
Spi Dynamics - http://zero.webappsecurity.com/
Cenzic- http://crackme.cenzic.com/Kelev/view/home.php
WatchFire - http://demo.testfire.net/
HackThisSite - http://www.hackthissite.org/
NTO - http://hackme.ntobjectives.com/
Accunetix - http://testaspnet.acunetix.com/login.aspx,[object Object]
Are there many attacks?
SQL Injection (Most common Injection Flaw)
Intro to SQL Injection… ,[object Object]
For example, a username and password is asked for on the Web page and the web page will pass it to the database to validate the information.
Some applications will not validate the field adequately before passing it to the database, and the database will process whatever it will receive.
Hackers will pass SQL commands directly to the database, and in some cases tables like “passwords” are returned because the SQL commands are not being filtered adequately.
SQL may return errors in the web page that even lists the correct tables to query so that the hacker may make more accurate attempts to get data.,[object Object]
For example: SELECT * FROM users WHERE username = ‘USRTEXT ' 
AND password = ‘PASSTEXT’ ,[object Object],SELECT * FROM users WHERE username = ‘’ OR 1=1 -- ' 
AND password = ‘PASSTEXT’ ,[object Object],[object Object]
ASP.NET HacmeBankAuthentication without username/password
Types of SQL Injection… ,[object Object]
Blind SQL Injection is performed when a hacker passes SQL commands into the web form and generic errors are returned to the user, for instance a “404” Error page or page not found.  The hacker has to make more extensive guesses on the database behind the web server.
Directed SQL Injection is when the web server returns SQL errors to the user that give information about the table that has issue processing the SQL command.  Some web pages may return “users.password table incorrect SQL query”, which gives the hacker the name of the database to launch the attack against. ,[object Object]
HackmeBooks SQL Injection(shows org.hsqldb.jdbc connection)
HackmeBooks SQL Injection(attacking) ,[object Object]
Session is now closed because we shutdown the database:,[object Object]
We see that it is SQL Server, and an “id” field into the “business.dbo.urltracking” table.  An Attacker can now try inserting into the table. ,[object Object]
Constrain the validation to not pass SQL commands to Dynamic SQL.
Use Stored Procedures.
Use Parameterized, or Prepared statements.
Use newer technology frameworks that are built using Parameterized statements like NHibernate and Spring.NET.
Use the ADO.NET Entity framework.,[object Object]
A sample stored procedure for exec sp_GetInventory ‘FL’ :,[object Object]
One the most dangerous Stored Procs in SQL Server is the default xp_cmd_shell.
If you have admin permissions with SQL server, you can try this simple example: exec master..xp_cmdshell ‘dir c:
Extending this feature, dynamic SQL may allow, in the username form : MyUsername; exec xp_cmdshell '"echo open 192.168.10.12" >> c:ack.txt’;
See http://www.informit.com/articles/article.aspx?p=30124&seqNum=3 for an example attack.  ,[object Object]
Entity Framework ,[object Object]
Entity Framework is part of .NET 4 and is often referred to as EF4. ,[object Object]
Entity Framework(Selecting ADO.NET in VS 2010)
A Sample Entity Framework(Model1.edmx with the VS Model Browser) Changes made to the model can propagate to the Database.
Another Example(Has all the details of the data)
A Database can be generated
Customize the code generated by the Entity Designer with T4  (.tt) templates ,[object Object]
 T4 is a means for creating code generated artifacts.
 T4 will generate a .tt file which looks like ASP classic syntax with the brackets.
 The .tt file is the Text Template file that will generate the background C# code from the Entity Model.
 Click on the model .edmx file and select “Add Code Generation File…” ,[object Object]
For VS 2010, I use the plugin at http://t4-editor.tangible-engineering.com                                                                   To
T4 Editor ,[object Object],[object Object],[object Object],[object Object],[object Object]
Its purpose is to relieve the developer from a significant amount of relational data persistence-related programming tasks.
The main advantages of Hibernate is that maps database entities to objects and hides the details of the data access from the business logic.
Hibernate uses prepared statements, so it is protected from direct SQL injection, but it could still be vulnerable to injecting HQL statements which are more complex to execute.   ,[object Object]
NHibernateValidator ,[object Object]
This validator (or constraint) will not only validate the values but can also validate the size of the data before being persisted.
Sample constraint annotations:public class Address {     [NotNull]     private string name;    // Cannot be null [NotNull]     [Length(Max = 5, Message = "{long}")] [Pattern(Regex = "[0-9]+")]// Regex for Digits  private string zip; // 5 digits
Recommendations ,[object Object]
ORM’s not only make the coding of data easier to the Database, by not using SQL in multiple places, but also alleviates many of the Dynamic SQL issues.   ,[object Object]
XSS ,[object Object]
The problem with using Javascript is the same as its purpose, the script can execute any script in the HTML browser, however, it may also execute any script put into its place.
Hackers can use Javascript to alert the browser to go to a different website, input some extra data, or even access data on the browser itself like browser cookies or the session information in the browser.
The hacker takes advantage of changing the information in the <script> … </script> tags.
The Javascript can be told to encode its programming to avoid taking information from other sources than the web server. ,[object Object]
Hacme Books XSS… ,[object Object],[object Object],[object Object],[object Object],[object Object]
If it has to be turned off because of legitimate reasons, it can be replaced by coding pieces of the Anti-XSS 3.1 library.
To turn it off, the web.config has to have the following added:,[object Object],[object Object]
The XSS Library can be broken down into two pieces, a library of protection routines (using Microsoft.Security.Application)  and also a a Security Runtime Engine (SRE) Configuration Utility.
The library routines will Encode the output so that it will not execute if passing from an external field.
The SRE inspects ASP.NET as it is executing and mitigates the XSS, in a similar method to a Web Application Firewall. ,[object Object]
XSS Microsoft Security Application(object viewer)
using Microsoft.Security.Application ,[object Object]
Executing as before with “<script>alert(document.cookie)</script>” only encodes the output without executing an alert: ,[object Object]
A “antixssmodule.config” has to be included to define what to check. the Conifguration Generator for SRE can be used.,[object Object]
Also add the SRE Filter in the “web.config” to look for the filtering:,[object Object],[object Object]
Different types of XSS have evolved so that new ones are being discovered in the wild constantly.
The protection has to be as robust as the attacks, and techniques need to evolve easily as well so that there filters, WAFs and multiple techniques can be used to protect against new attacks. ,[object Object]
CSRF(XSS Evolving) ,[object Object]
The benefit to the attacker, is that if a hidden image is injected into a user’s browser, and their browser currently has their bank authentication cookie, then the hacker may hijack the victims authentication.
 Let’s try a test on a Sample Web site….,[object Object],[object Object],[object Object]
A reference could be many items like an “image (<img>)” or even an XMLHTTP object. http://www.cgisecurity.com/csrf-faq.htm
To test, I usually try images, like a Google img from their site. <imgsrc="http://www.google.com/images/logos/ps_logo2.png" width="80" height"80" border="0"/>  gives me: ,[object Object],[object Object]
That’s easy to see.  ,[object Object]
In the “( )” is actually an image linking to another website.  If an img is now linked, so can other tags, even some pulling or referring information over. ,[object Object],[object Object],[object Object]
The attacker doesn’t have access to the token in the browser to perform the transaction.  ,[object Object]
Then the server must validate the token before executing the code :,[object Object]
To understand this technology, a quick understanding of ASP.NET MVC2 is needed. ,[object Object]
MVC	 ,[object Object],Here are the pieces:
Microsoft Visual Web Developer 2010 Express	 ,[object Object],[object Object]
The Controllers classes will implement the :Controller  (IController) interface.  ActionResults are returned from  the functions. The code is annotated with [HTTPPost] and   [Authorize] definitions. ,[object Object],getters and setters to the data in the  form of { get; set; }. It is defined with a #region models area.
Blocking CSRF in the Controller ,[object Object]
Microsoft offers a validation for CSRF, called “ValidateAntiForgeryToken”. Example code below shows it examining the data before returning it to the next view:,[object Object],[object Object],[object Object],[object Object]
JSON ,[object Object]
Information on it can be found at http://json.org/ .
JSON is sometimes used in transfer of data, like in Ajax, instead of XML.
JSON is used instead of XML because it has a smaller file footprint and can be read easily into Javascript.
JSON is normally defined by using the mime type “application/json” and also by using the file type “.json”.
To understand JSON, a small understanding of AJAX must occur first. ,[object Object]
 Data is usually retrieved using the XMLHttpRequest (XHR) object from the server asynchronously.
Javascript (ECMAScript) is used for local processing, and the Document Object Model (DOM) is used to access the data inside the page or read XML from the server.  This means that the browser only sends and receives the parts that it needs to change and tries to process some data locally.
Ajax is server agnostic.
Ajax is not a technology in itself, but a group of technologies.  ,[object Object]
Ajax (a walk through – Http POST) ,[object Object]
 The browser has to interpret the Javascript regardless of how it is encoded and decoded.  If a browser can read the Javascript, then the Javascript can be debugged/monitored and manipulated using a JavaScript reverser to intercept the functions.
 The defense is to validate the Server code.
The Page_Load ( ) will get the XML file and must parse through it. ,[object Object],[object Object],[object Object]
JQuery is the most popular JavaScript library in use today.
JQuery syntax is designed to make it easier to navigate a document, select DOM elements, and develop Ajax applications. ,[object Object]
jquery.validate.js ,[object Object],[object Object]
JSON example
Similar XML example
JSON Hijacking ,[object Object]
 It requires redirection to a new site and suing JSON through a GET interface. ,[object Object],[object Object],[object Object]
 Flex uses the Flash plugin for running it’s GUI program. http://flex.org/
Silverlight programs use the Silverlightplugin for running its environment. http://www.silverlight.net/
 So the hacking tools normally have to have the plugin in the client as well to talk to these technologies, including Web Scanners.
 Many of the attacks will now not only be limited to the Flex or Silverlightdeployement but also to the plugin as well.
 These technologies are platform agnostic as long as the plugin is supported in the browser. ,[object Object]
 They both can communicate and work with Javascript, therefore they could be susceptible to any XSS form of attack.
 The best defense is to use WCF to Authenticate, Authorize and Encrypt any communication to the browser and server. ,[object Object]
 Flex uses MXML, the Macromedia XML, as a declarative layout of the interfaces to compile into the SWF file that is deployed.
  To extend the MXML, Flex uses a language called ActionScript, which is similar to Java. ActionScript can be called from the MXML file using the <mx:script> tag.
<mx:script source = “code.as”/>,[object Object]
FlexBuilder 3 Example
Example <mx:CreditCardValidator> tag
SWFScan ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
 Microsoft offers stripped down versions of Visual Studio to get started with Silverlight from http://www.silverlight.net/getstarted/ .
The files created when creating a Silverlight project include:,[object Object]
  The browser loads the Silverlight plug-in.
  It then downloads the XAP file that contains your application. This file uses the standard .zip compression.
  The Silverlight plug-in reads the AppManifest.xml file from the XAP to find out what assemblies your application uses. It creates the Silverlight runtime environment and then loads your application assembly (along with any dependent assemblies).
  The Silverlight plug-in creates an instance of your custom application class (which is defined in the App.xaml and App.xaml.cs files).
  The default constructor of the application class raises the Startup event.
  Your application handles the Startup event and creates the root visual object for your application.
XAML (eXtended Application Markup Language) is XML for Silverlight, mostly for graphics.  ,[object Object]
 SilverlightApplication3TestPage.aspx – This is a ASP page that will need to be deployed on a Web server to test the Silverlight project SilverlightApplication3. This can be used a entry point into the Silverlight Application.
 SilverlightApplication1TestPage.html – This is a HTML page that will need to be deployed on a Web server to test the Silverlight project SilverlightApplication3. This can be used a entry point into the Silverlight Application.
Web.config -  to allow configuration of the test pages.,[object Object]
A Silverlight examplehttp://memorabilia.hardrock.com/
XamlPad(A visual XAML editor) ,[object Object],[object Object],[object Object]
Some Silverlight Links ,[object Object]
MoonLight, the Open Source Silverlight project for Linux and Unix, http://www.mono-project.com/Moonlight,[object Object]
IIS 5.0 WebDav (A side note because it has caused hacks) ,[object Object]
Microsoft has instructions to disable WebDavhttp://support.microsoft.com/default.aspx?scid=kb;en-us;241520,[object Object]
Who’s seeing your data? 	 ,[object Object]
When a system is in production, and especially on the Internet, there is no guarantee that you know who is watching the data transmitted between the user and the server.  This may also apply to the Local Area Network as well.
Never take it for granted that access cannot be broken.
Always, use common algorithms that come with Java.  Common algorithms are tested well and are vetted by millions.
Keep the keys as secure as the data, because they can unlock the data.
Homemade encryptions algorithms may end up costing more than standard encryptions if broken. ,[object Object]
The one-way hash generates a fixed size hash some given any size data.
The data cannot be reversed engineered from the hash, hence one-way.
The same data generates the same hash sum.
Different data generates different hash sums.(Note: In rare cases, collisions, different data generates the same sum).
Md5 ,[object Object]
The 128 bit hash sum can be used to ensure if there has been tampering of data or a file.
A common comparison is to store passwords in a table, and instead of checking the password, compare the hash of the password, so that the password does not have to be stored. ,[object Object]
Sha1 ,[object Object]
Other SHA’s are SHA224,SHA256,SHA384, and SHA512, each one denoting the size in bits of the message digest. ,[object Object]
AES ,[object Object]
The Rijndael algorithm was selected, developed by two Belgian cryptographers, Joan Daemen and Vincent Rijmen.
The NIST adapted the variable key space into 128, 192, or 256 bits as FIPS 197 and called it AES.
AES is a symmetric key algorithm, meaning that the same key is used to both encrypt and decrypt.,[object Object],[object Object],[object Object],[object Object],[object Object]
The Asymmetric algorithm can generate key pairs, one private key for encrypting, and its pair is handed out for decryption to more people, the public key.
The key pair are formulated from a pair of prime numbers using a modulus equation that become linked to each other.,[object Object]
RSA Keys, a simple encrypt/decrypt public  key = (e, n)  = (17, 3233) private key = (d, n) = ( 2753, 3233) To compute the ciphertext we use  C = Pe (mod n). For example, P = 65 and is the letter ‘H’. C = 2790 = 6517 mod 3233.    Back to Plaintext, P = Cd mod n. P = 65 = 27902753 mod 3233.  Which returns 65 for ‘H’.   
C# RSA Keys
C# RSA Keys (output of private)
C# RSA Encrypt/Decrypt
Digital certificates
Beyond Encryption ,[object Object]
A  larger, combined, piece is the Digital Certificate.
A Digital Certificate is a protocol X509 structure that contains verification of the certificate, Non-repudiation (proof of receipt), and third party authentication through a Certificate Authority.
The Digital Certificate is the heart of Hypertext Transfer Protocol over Secure Socket Layer (HTTPS) and Public Key Infrastructure (PKI).
PKI is the process of authentication through a trusted party called Certificate Authority (CA). This could be a third party or self signed internally through a domain controller.
HTTPS allows secure transport over Web Services and Web Servers, and in some cases secure file transport services. ,[object Object]
Microsoft Tools ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
The “using System.Security.Cryptography.X509Certificates” handles many of the certificate methods, lets show some certificate entries:,[object Object],[object Object]
Websites can get accessed by typing in “admin” “admin” at times, and auditors try a range of default and well known logins.
Use complex and different passwords, if its hard to keep track of them then use something like keepass. http://keepass.info/,[object Object]
Intro to SOA	 ,[object Object]
The eXtensible Markup Language (XML) defines the interfaces and content of the message.
A Service Oriented Architecture (SOA) is a flexible set of design principles to define a architecture to provide a loosely-integrated suite of services that can be used in multiple business domains.   This architecture makes extensive use of XML. ,[object Object]
Steps in Web Services ,[object Object]
UDDI provides for discovery of services and retrieval of their WSDL descriptions as a directory service.  This service may require authentication and encrypt the HTTP protocol.
The UDDI will return the WSDL and forward the client to the proxy that will contain the service, usually in the form of a URL.
The WSDL will define the acceptable interface into the SOA.
The client SOAP call will format the acceptable XML.  SOAP will act as an envelope to the SOA.
The SOA will accept the call if it meets the WSDL criteria and process the call.
The SOA will respond based on the SOAP call to the corresponding client. ,[object Object]

More Related Content

What's hot

&lt;img src="../i/r_14.png" />
&lt;img src="../i/r_14.png" />&lt;img src="../i/r_14.png" />
&lt;img src="../i/r_14.png" />tutorialsruby
 
Adam Peller Interoperable Ajax Tools And Mashups
Adam Peller Interoperable Ajax Tools And MashupsAdam Peller Interoperable Ajax Tools And Mashups
Adam Peller Interoperable Ajax Tools And MashupsAjax Experience 2009
 
Java Deserialization Vulnerabilities - The Forgotten Bug Class (RuhrSec Edition)
Java Deserialization Vulnerabilities - The Forgotten Bug Class (RuhrSec Edition)Java Deserialization Vulnerabilities - The Forgotten Bug Class (RuhrSec Edition)
Java Deserialization Vulnerabilities - The Forgotten Bug Class (RuhrSec Edition)CODE WHITE GmbH
 
JSR 168 Portal - Overview
JSR 168 Portal - OverviewJSR 168 Portal - Overview
JSR 168 Portal - OverviewVinay Kumar
 
IPaste SDK v.1.0
IPaste SDK v.1.0IPaste SDK v.1.0
IPaste SDK v.1.0xrebyc
 
The old is new, again. CVE-2011-2461 is back!
The old is new, again. CVE-2011-2461 is back!The old is new, again. CVE-2011-2461 is back!
The old is new, again. CVE-2011-2461 is back!Luca Carettoni
 
Class notes(week 10) on applet programming
Class notes(week 10) on applet programmingClass notes(week 10) on applet programming
Class notes(week 10) on applet programmingKuntal Bhowmick
 
JAVA INTRODUCTION
JAVA INTRODUCTIONJAVA INTRODUCTION
JAVA INTRODUCTIONProf Ansari
 
Surviving the Java Deserialization Apocalypse // OWASP AppSecEU 2016
Surviving the Java Deserialization Apocalypse // OWASP AppSecEU 2016Surviving the Java Deserialization Apocalypse // OWASP AppSecEU 2016
Surviving the Java Deserialization Apocalypse // OWASP AppSecEU 2016Christian Schneider
 
EclipseMAT
EclipseMATEclipseMAT
EclipseMATAli Bahu
 
Ruby On Rails Seminar Basis Softexpo Feb2010
Ruby On Rails Seminar Basis Softexpo Feb2010Ruby On Rails Seminar Basis Softexpo Feb2010
Ruby On Rails Seminar Basis Softexpo Feb2010arif44
 

What's hot (19)

&lt;img src="../i/r_14.png" />
&lt;img src="../i/r_14.png" />&lt;img src="../i/r_14.png" />
&lt;img src="../i/r_14.png" />
 
Adam Peller Interoperable Ajax Tools And Mashups
Adam Peller Interoperable Ajax Tools And MashupsAdam Peller Interoperable Ajax Tools And Mashups
Adam Peller Interoperable Ajax Tools And Mashups
 
Java Deserialization Vulnerabilities - The Forgotten Bug Class (RuhrSec Edition)
Java Deserialization Vulnerabilities - The Forgotten Bug Class (RuhrSec Edition)Java Deserialization Vulnerabilities - The Forgotten Bug Class (RuhrSec Edition)
Java Deserialization Vulnerabilities - The Forgotten Bug Class (RuhrSec Edition)
 
JSR 168 Portal - Overview
JSR 168 Portal - OverviewJSR 168 Portal - Overview
JSR 168 Portal - Overview
 
IPaste SDK v.1.0
IPaste SDK v.1.0IPaste SDK v.1.0
IPaste SDK v.1.0
 
The old is new, again. CVE-2011-2461 is back!
The old is new, again. CVE-2011-2461 is back!The old is new, again. CVE-2011-2461 is back!
The old is new, again. CVE-2011-2461 is back!
 
Spring aop
Spring aopSpring aop
Spring aop
 
Class notes(week 10) on applet programming
Class notes(week 10) on applet programmingClass notes(week 10) on applet programming
Class notes(week 10) on applet programming
 
B.Sc. III(VI Sem) Advance Java Unit2: Appet
B.Sc. III(VI Sem) Advance Java Unit2: AppetB.Sc. III(VI Sem) Advance Java Unit2: Appet
B.Sc. III(VI Sem) Advance Java Unit2: Appet
 
iOS Masque Attack
iOS Masque AttackiOS Masque Attack
iOS Masque Attack
 
Java essential notes
Java essential notesJava essential notes
Java essential notes
 
JAVA INTRODUCTION
JAVA INTRODUCTIONJAVA INTRODUCTION
JAVA INTRODUCTION
 
Surviving the Java Deserialization Apocalypse // OWASP AppSecEU 2016
Surviving the Java Deserialization Apocalypse // OWASP AppSecEU 2016Surviving the Java Deserialization Apocalypse // OWASP AppSecEU 2016
Surviving the Java Deserialization Apocalypse // OWASP AppSecEU 2016
 
EclipseMAT
EclipseMATEclipseMAT
EclipseMAT
 
Java Enterprise Edition
Java Enterprise EditionJava Enterprise Edition
Java Enterprise Edition
 
Apache Ant
Apache AntApache Ant
Apache Ant
 
Java basics notes
Java basics notesJava basics notes
Java basics notes
 
Ruby On Rails Seminar Basis Softexpo Feb2010
Ruby On Rails Seminar Basis Softexpo Feb2010Ruby On Rails Seminar Basis Softexpo Feb2010
Ruby On Rails Seminar Basis Softexpo Feb2010
 
Flask Basics
Flask BasicsFlask Basics
Flask Basics
 

Similar to C# Web Security Class Overview

Java Web Security Class
Java Web Security ClassJava Web Security Class
Java Web Security ClassRich Helton
 
Sql Injection and Entity Frameworks
Sql Injection and Entity FrameworksSql Injection and Entity Frameworks
Sql Injection and Entity FrameworksRich Helton
 
Web application attacks
Web application attacksWeb application attacks
Web application attackshruth
 
04. xss and encoding
04.  xss and encoding04.  xss and encoding
04. xss and encodingEoin Keary
 
Web Attacks - Top threats - 2010
Web Attacks - Top threats - 2010Web Attacks - Top threats - 2010
Web Attacks - Top threats - 2010Shreeraj Shah
 
SQL Server Security - Attack
SQL Server Security - Attack SQL Server Security - Attack
SQL Server Security - Attack webhostingguy
 
Pentesting for startups
Pentesting for startupsPentesting for startups
Pentesting for startupslevigross
 
Manindra kishore _incident_handling_n_log_analysis - ClubHack2009
Manindra kishore _incident_handling_n_log_analysis - ClubHack2009Manindra kishore _incident_handling_n_log_analysis - ClubHack2009
Manindra kishore _incident_handling_n_log_analysis - ClubHack2009ClubHack
 
Ultimate Free SQL Server Toolkit
Ultimate Free SQL Server ToolkitUltimate Free SQL Server Toolkit
Ultimate Free SQL Server ToolkitKevin Kline
 
Hacking WebApps for fun and profit : how to approach a target?
Hacking WebApps for fun and profit : how to approach a target?Hacking WebApps for fun and profit : how to approach a target?
Hacking WebApps for fun and profit : how to approach a target?Yassine Aboukir
 
Web Browser Basics, Tips & Tricks Draft 17
Web Browser Basics, Tips & Tricks Draft 17Web Browser Basics, Tips & Tricks Draft 17
Web Browser Basics, Tips & Tricks Draft 17msz
 
Top 10 Security Vulnerabilities (2006)
Top 10 Security Vulnerabilities (2006)Top 10 Security Vulnerabilities (2006)
Top 10 Security Vulnerabilities (2006)Susam Pal
 
Intro to Web Application Security
Intro to Web Application SecurityIntro to Web Application Security
Intro to Web Application SecurityRob Ragan
 
Sql Injections With Real Life Scenarious
Sql Injections With Real Life ScenariousSql Injections With Real Life Scenarious
Sql Injections With Real Life ScenariousFrancis Alexander
 
Attackers Vs Programmers
Attackers Vs ProgrammersAttackers Vs Programmers
Attackers Vs Programmersrobin_bene
 

Similar to C# Web Security Class Overview (20)

Java Web Security Class
Java Web Security ClassJava Web Security Class
Java Web Security Class
 
Sql Injection and Entity Frameworks
Sql Injection and Entity FrameworksSql Injection and Entity Frameworks
Sql Injection and Entity Frameworks
 
Web Security
Web SecurityWeb Security
Web Security
 
Web application attacks
Web application attacksWeb application attacks
Web application attacks
 
Real web-attack-scenario
Real web-attack-scenarioReal web-attack-scenario
Real web-attack-scenario
 
Web Security
Web SecurityWeb Security
Web Security
 
04. xss and encoding
04.  xss and encoding04.  xss and encoding
04. xss and encoding
 
Romulus OWASP
Romulus OWASPRomulus OWASP
Romulus OWASP
 
Web Attacks - Top threats - 2010
Web Attacks - Top threats - 2010Web Attacks - Top threats - 2010
Web Attacks - Top threats - 2010
 
SQL Server Security - Attack
SQL Server Security - Attack SQL Server Security - Attack
SQL Server Security - Attack
 
Pentesting for startups
Pentesting for startupsPentesting for startups
Pentesting for startups
 
Manindra kishore _incident_handling_n_log_analysis - ClubHack2009
Manindra kishore _incident_handling_n_log_analysis - ClubHack2009Manindra kishore _incident_handling_n_log_analysis - ClubHack2009
Manindra kishore _incident_handling_n_log_analysis - ClubHack2009
 
Ultimate Free SQL Server Toolkit
Ultimate Free SQL Server ToolkitUltimate Free SQL Server Toolkit
Ultimate Free SQL Server Toolkit
 
Hacking WebApps for fun and profit : how to approach a target?
Hacking WebApps for fun and profit : how to approach a target?Hacking WebApps for fun and profit : how to approach a target?
Hacking WebApps for fun and profit : how to approach a target?
 
Web Browser Basics, Tips & Tricks Draft 17
Web Browser Basics, Tips & Tricks Draft 17Web Browser Basics, Tips & Tricks Draft 17
Web Browser Basics, Tips & Tricks Draft 17
 
Top 10 Security Vulnerabilities (2006)
Top 10 Security Vulnerabilities (2006)Top 10 Security Vulnerabilities (2006)
Top 10 Security Vulnerabilities (2006)
 
Intro to Web Application Security
Intro to Web Application SecurityIntro to Web Application Security
Intro to Web Application Security
 
Sql Injections With Real Life Scenarious
Sql Injections With Real Life ScenariousSql Injections With Real Life Scenarious
Sql Injections With Real Life Scenarious
 
API SECURITY
API SECURITYAPI SECURITY
API SECURITY
 
Attackers Vs Programmers
Attackers Vs ProgrammersAttackers Vs Programmers
Attackers Vs Programmers
 

More from Rich Helton

Mongo db rev001.
Mongo db rev001.Mongo db rev001.
Mongo db rev001.Rich Helton
 
NServicebus WCF Integration 101
NServicebus WCF Integration 101NServicebus WCF Integration 101
NServicebus WCF Integration 101Rich Helton
 
AspMVC4 start101
AspMVC4 start101AspMVC4 start101
AspMVC4 start101Rich Helton
 
Entity frameworks101
Entity frameworks101Entity frameworks101
Entity frameworks101Rich Helton
 
Tumbleweed intro
Tumbleweed introTumbleweed intro
Tumbleweed introRich Helton
 
Salesforce Intro
Salesforce IntroSalesforce Intro
Salesforce IntroRich Helton
 
LEARNING  iPAD STORYBOARDS IN OBJ-­‐C LESSON 1
LEARNING	 iPAD STORYBOARDS IN OBJ-­‐C LESSON 1LEARNING	 iPAD STORYBOARDS IN OBJ-­‐C LESSON 1
LEARNING  iPAD STORYBOARDS IN OBJ-­‐C LESSON 1Rich Helton
 
Learning C# iPad Programming
Learning C# iPad ProgrammingLearning C# iPad Programming
Learning C# iPad ProgrammingRich Helton
 
First Steps in Android
First Steps in AndroidFirst Steps in Android
First Steps in AndroidRich Helton
 
Python For Droid
Python For DroidPython For Droid
Python For DroidRich Helton
 
Spring Roo Rev005
Spring Roo Rev005Spring Roo Rev005
Spring Roo Rev005Rich Helton
 
Overview of CSharp MVC3 and EF4
Overview of CSharp MVC3 and EF4Overview of CSharp MVC3 and EF4
Overview of CSharp MVC3 and EF4Rich Helton
 
Web Application Firewall intro
Web Application Firewall introWeb Application Firewall intro
Web Application Firewall introRich Helton
 

More from Rich Helton (17)

Mongo db rev001.
Mongo db rev001.Mongo db rev001.
Mongo db rev001.
 
NServicebus WCF Integration 101
NServicebus WCF Integration 101NServicebus WCF Integration 101
NServicebus WCF Integration 101
 
AspMVC4 start101
AspMVC4 start101AspMVC4 start101
AspMVC4 start101
 
Entity frameworks101
Entity frameworks101Entity frameworks101
Entity frameworks101
 
Tumbleweed intro
Tumbleweed introTumbleweed intro
Tumbleweed intro
 
Azure rev002
Azure rev002Azure rev002
Azure rev002
 
Salesforce Intro
Salesforce IntroSalesforce Intro
Salesforce Intro
 
LEARNING  iPAD STORYBOARDS IN OBJ-­‐C LESSON 1
LEARNING	 iPAD STORYBOARDS IN OBJ-­‐C LESSON 1LEARNING	 iPAD STORYBOARDS IN OBJ-­‐C LESSON 1
LEARNING  iPAD STORYBOARDS IN OBJ-­‐C LESSON 1
 
Learning C# iPad Programming
Learning C# iPad ProgrammingLearning C# iPad Programming
Learning C# iPad Programming
 
First Steps in Android
First Steps in AndroidFirst Steps in Android
First Steps in Android
 
NServiceBus
NServiceBusNServiceBus
NServiceBus
 
Python For Droid
Python For DroidPython For Droid
Python For Droid
 
Spring Roo Rev005
Spring Roo Rev005Spring Roo Rev005
Spring Roo Rev005
 
Python Final
Python FinalPython Final
Python Final
 
Overview of CSharp MVC3 and EF4
Overview of CSharp MVC3 and EF4Overview of CSharp MVC3 and EF4
Overview of CSharp MVC3 and EF4
 
Jira Rev002
Jira Rev002Jira Rev002
Jira Rev002
 
Web Application Firewall intro
Web Application Firewall introWeb Application Firewall intro
Web Application Firewall intro
 

Recently uploaded

TeamStation AI System Report LATAM IT Salaries 2024
TeamStation AI System Report LATAM IT Salaries 2024TeamStation AI System Report LATAM IT Salaries 2024
TeamStation AI System Report LATAM IT Salaries 2024Lonnie McRorey
 
Powerpoint exploring the locations used in television show Time Clash
Powerpoint exploring the locations used in television show Time ClashPowerpoint exploring the locations used in television show Time Clash
Powerpoint exploring the locations used in television show Time Clashcharlottematthew16
 
WordPress Websites for Engineers: Elevate Your Brand
WordPress Websites for Engineers: Elevate Your BrandWordPress Websites for Engineers: Elevate Your Brand
WordPress Websites for Engineers: Elevate Your Brandgvaughan
 
Ensuring Technical Readiness For Copilot in Microsoft 365
Ensuring Technical Readiness For Copilot in Microsoft 365Ensuring Technical Readiness For Copilot in Microsoft 365
Ensuring Technical Readiness For Copilot in Microsoft 3652toLead Limited
 
SAP Build Work Zone - Overview L2-L3.pptx
SAP Build Work Zone - Overview L2-L3.pptxSAP Build Work Zone - Overview L2-L3.pptx
SAP Build Work Zone - Overview L2-L3.pptxNavinnSomaal
 
Human Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR SystemsHuman Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR SystemsMark Billinghurst
 
Gen AI in Business - Global Trends Report 2024.pdf
Gen AI in Business - Global Trends Report 2024.pdfGen AI in Business - Global Trends Report 2024.pdf
Gen AI in Business - Global Trends Report 2024.pdfAddepto
 
Connect Wave/ connectwave Pitch Deck Presentation
Connect Wave/ connectwave Pitch Deck PresentationConnect Wave/ connectwave Pitch Deck Presentation
Connect Wave/ connectwave Pitch Deck PresentationSlibray Presentation
 
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024BookNet Canada
 
Developer Data Modeling Mistakes: From Postgres to NoSQL
Developer Data Modeling Mistakes: From Postgres to NoSQLDeveloper Data Modeling Mistakes: From Postgres to NoSQL
Developer Data Modeling Mistakes: From Postgres to NoSQLScyllaDB
 
"ML in Production",Oleksandr Bagan
"ML in Production",Oleksandr Bagan"ML in Production",Oleksandr Bagan
"ML in Production",Oleksandr BaganFwdays
 
How to write a Business Continuity Plan
How to write a Business Continuity PlanHow to write a Business Continuity Plan
How to write a Business Continuity PlanDatabarracks
 
How AI, OpenAI, and ChatGPT impact business and software.
How AI, OpenAI, and ChatGPT impact business and software.How AI, OpenAI, and ChatGPT impact business and software.
How AI, OpenAI, and ChatGPT impact business and software.Curtis Poe
 
Vertex AI Gemini Prompt Engineering Tips
Vertex AI Gemini Prompt Engineering TipsVertex AI Gemini Prompt Engineering Tips
Vertex AI Gemini Prompt Engineering TipsMiki Katsuragi
 
DSPy a system for AI to Write Prompts and Do Fine Tuning
DSPy a system for AI to Write Prompts and Do Fine TuningDSPy a system for AI to Write Prompts and Do Fine Tuning
DSPy a system for AI to Write Prompts and Do Fine TuningLars Bell
 
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptx
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptxMerck Moving Beyond Passwords: FIDO Paris Seminar.pptx
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptxLoriGlavin3
 
Dev Dives: Streamline document processing with UiPath Studio Web
Dev Dives: Streamline document processing with UiPath Studio WebDev Dives: Streamline document processing with UiPath Studio Web
Dev Dives: Streamline document processing with UiPath Studio WebUiPathCommunity
 
Streamlining Python Development: A Guide to a Modern Project Setup
Streamlining Python Development: A Guide to a Modern Project SetupStreamlining Python Development: A Guide to a Modern Project Setup
Streamlining Python Development: A Guide to a Modern Project SetupFlorian Wilhelm
 
Designing IA for AI - Information Architecture Conference 2024
Designing IA for AI - Information Architecture Conference 2024Designing IA for AI - Information Architecture Conference 2024
Designing IA for AI - Information Architecture Conference 2024Enterprise Knowledge
 
TrustArc Webinar - How to Build Consumer Trust Through Data Privacy
TrustArc Webinar - How to Build Consumer Trust Through Data PrivacyTrustArc Webinar - How to Build Consumer Trust Through Data Privacy
TrustArc Webinar - How to Build Consumer Trust Through Data PrivacyTrustArc
 

Recently uploaded (20)

TeamStation AI System Report LATAM IT Salaries 2024
TeamStation AI System Report LATAM IT Salaries 2024TeamStation AI System Report LATAM IT Salaries 2024
TeamStation AI System Report LATAM IT Salaries 2024
 
Powerpoint exploring the locations used in television show Time Clash
Powerpoint exploring the locations used in television show Time ClashPowerpoint exploring the locations used in television show Time Clash
Powerpoint exploring the locations used in television show Time Clash
 
WordPress Websites for Engineers: Elevate Your Brand
WordPress Websites for Engineers: Elevate Your BrandWordPress Websites for Engineers: Elevate Your Brand
WordPress Websites for Engineers: Elevate Your Brand
 
Ensuring Technical Readiness For Copilot in Microsoft 365
Ensuring Technical Readiness For Copilot in Microsoft 365Ensuring Technical Readiness For Copilot in Microsoft 365
Ensuring Technical Readiness For Copilot in Microsoft 365
 
SAP Build Work Zone - Overview L2-L3.pptx
SAP Build Work Zone - Overview L2-L3.pptxSAP Build Work Zone - Overview L2-L3.pptx
SAP Build Work Zone - Overview L2-L3.pptx
 
Human Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR SystemsHuman Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR Systems
 
Gen AI in Business - Global Trends Report 2024.pdf
Gen AI in Business - Global Trends Report 2024.pdfGen AI in Business - Global Trends Report 2024.pdf
Gen AI in Business - Global Trends Report 2024.pdf
 
Connect Wave/ connectwave Pitch Deck Presentation
Connect Wave/ connectwave Pitch Deck PresentationConnect Wave/ connectwave Pitch Deck Presentation
Connect Wave/ connectwave Pitch Deck Presentation
 
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
 
Developer Data Modeling Mistakes: From Postgres to NoSQL
Developer Data Modeling Mistakes: From Postgres to NoSQLDeveloper Data Modeling Mistakes: From Postgres to NoSQL
Developer Data Modeling Mistakes: From Postgres to NoSQL
 
"ML in Production",Oleksandr Bagan
"ML in Production",Oleksandr Bagan"ML in Production",Oleksandr Bagan
"ML in Production",Oleksandr Bagan
 
How to write a Business Continuity Plan
How to write a Business Continuity PlanHow to write a Business Continuity Plan
How to write a Business Continuity Plan
 
How AI, OpenAI, and ChatGPT impact business and software.
How AI, OpenAI, and ChatGPT impact business and software.How AI, OpenAI, and ChatGPT impact business and software.
How AI, OpenAI, and ChatGPT impact business and software.
 
Vertex AI Gemini Prompt Engineering Tips
Vertex AI Gemini Prompt Engineering TipsVertex AI Gemini Prompt Engineering Tips
Vertex AI Gemini Prompt Engineering Tips
 
DSPy a system for AI to Write Prompts and Do Fine Tuning
DSPy a system for AI to Write Prompts and Do Fine TuningDSPy a system for AI to Write Prompts and Do Fine Tuning
DSPy a system for AI to Write Prompts and Do Fine Tuning
 
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptx
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptxMerck Moving Beyond Passwords: FIDO Paris Seminar.pptx
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptx
 
Dev Dives: Streamline document processing with UiPath Studio Web
Dev Dives: Streamline document processing with UiPath Studio WebDev Dives: Streamline document processing with UiPath Studio Web
Dev Dives: Streamline document processing with UiPath Studio Web
 
Streamlining Python Development: A Guide to a Modern Project Setup
Streamlining Python Development: A Guide to a Modern Project SetupStreamlining Python Development: A Guide to a Modern Project Setup
Streamlining Python Development: A Guide to a Modern Project Setup
 
Designing IA for AI - Information Architecture Conference 2024
Designing IA for AI - Information Architecture Conference 2024Designing IA for AI - Information Architecture Conference 2024
Designing IA for AI - Information Architecture Conference 2024
 
TrustArc Webinar - How to Build Consumer Trust Through Data Privacy
TrustArc Webinar - How to Build Consumer Trust Through Data PrivacyTrustArc Webinar - How to Build Consumer Trust Through Data Privacy
TrustArc Webinar - How to Build Consumer Trust Through Data Privacy
 

C# Web Security Class Overview

  • 1. C# Web Security Class October 27, 2010
  • 2.
  • 3. Time: 8:30 AM – 4:00 PM
  • 4. Lunch Break: 11:30 – 12:30 P.M.
  • 6. My personal website that contains some slides at http://www.s3curitys0lutions.com/
  • 9.
  • 10.
  • 17.
  • 18. Web Attacks are the most common (from the 2010 ArcSight survey)
  • 19.
  • 20. SANs 2010 Top Cyber Security Risks
  • 21.
  • 22. The ASP.NET Security Checklist http://msdn.microsoft.com/en-us/library/ff648269.aspx
  • 23. WebAppSec Excel checklist http://img.a4apphack.com/dl/appsecchck-checklist.zip
  • 24. SANs reading Web Security Checklist http://www.sans.org/reading_room/whitepapers/securecode/security-checklist-web-application-design_1389
  • 25.
  • 26. Find and validate all input. This includes URL’s, JavaScript's, links, username and passwords, and especially any field calling a database.
  • 27. Never trust data in files, the network or database to be secure. Encrypt anything important, passwords, SSN’s, configurations.
  • 28. Never trust the source, be it customer or a service. Authenticate, Authorize and validate.
  • 29. Whenever a abnormal behavior occurs, error check and log.
  • 30.
  • 31.
  • 32. They are bots (automated scanners) from Virus vendors, Security organizations, search engines and more cataloging all web sites.
  • 33. There is the famous GoogleBot, http://en.wikipedia.org/wiki/Googlebot, that will look for the local robots.txt, see http://www.robotstxt.org/ , to define what to search for on the web site. Hackers usually don’t respect these gentlemen agreements on the Internet.
  • 34. There are so many scans on the Internet that many consider it white noise and careers have been built dedicated on sifting through the network traffics white noise.
  • 35.
  • 36.
  • 37. A well known site containing a database of various keywords is found at http://www.hackersforcharity.org/ghdb/ .
  • 38. For example, “ext:asp” can be used to find pages ending in asp.
  • 39. For example,“ Hacking filetype:pdf” can be used to find PDFs that are about hacking.
  • 40. For example, “restaurants inanchor:menu” will find restaurants with menu links in them.
  • 41.
  • 42.
  • 43.
  • 44. Just because you changed the web site, doesn’t mean it went away, see www.archive.org,
  • 45.
  • 46.
  • 47. Some download applications to practice web hacking locally are:
  • 48. OWASP WebGoat (JSPs/Servlets) -http://www.owasp.org/index.php/OWASP_WebGoat_Project
  • 49. Hackme Bank (.Net) - http://www.foundstone.com/us/resources/proddesc/hacmebank.htm
  • 50. Hackme Books (JSPs/Servlets) –http://www.foundstone.com/us/resources/proddesc/hacmebooks.htm
  • 51. SecuriBench (Java Code) – http://suif.stanford.edu/~livshits/securibench/
  • 52.
  • 53. Spi Dynamics - http://zero.webappsecurity.com/
  • 58.
  • 59. Are there many attacks?
  • 60. SQL Injection (Most common Injection Flaw)
  • 61.
  • 62. For example, a username and password is asked for on the Web page and the web page will pass it to the database to validate the information.
  • 63. Some applications will not validate the field adequately before passing it to the database, and the database will process whatever it will receive.
  • 64. Hackers will pass SQL commands directly to the database, and in some cases tables like “passwords” are returned because the SQL commands are not being filtered adequately.
  • 65.
  • 66.
  • 68.
  • 69. Blind SQL Injection is performed when a hacker passes SQL commands into the web form and generic errors are returned to the user, for instance a “404” Error page or page not found. The hacker has to make more extensive guesses on the database behind the web server.
  • 70.
  • 71. HackmeBooks SQL Injection(shows org.hsqldb.jdbc connection)
  • 72.
  • 73.
  • 74.
  • 75. Constrain the validation to not pass SQL commands to Dynamic SQL.
  • 77. Use Parameterized, or Prepared statements.
  • 78. Use newer technology frameworks that are built using Parameterized statements like NHibernate and Spring.NET.
  • 79.
  • 80.
  • 81. One the most dangerous Stored Procs in SQL Server is the default xp_cmd_shell.
  • 82. If you have admin permissions with SQL server, you can try this simple example: exec master..xp_cmdshell ‘dir c:
  • 83. Extending this feature, dynamic SQL may allow, in the username form : MyUsername; exec xp_cmdshell '"echo open 192.168.10.12" >> c:ack.txt’;
  • 84.
  • 85.
  • 86.
  • 88. A Sample Entity Framework(Model1.edmx with the VS Model Browser) Changes made to the model can propagate to the Database.
  • 89. Another Example(Has all the details of the data)
  • 90. A Database can be generated
  • 91.
  • 92. T4 is a means for creating code generated artifacts.
  • 93. T4 will generate a .tt file which looks like ASP classic syntax with the brackets.
  • 94. The .tt file is the Text Template file that will generate the background C# code from the Entity Model.
  • 95.
  • 96. For VS 2010, I use the plugin at http://t4-editor.tangible-engineering.com To
  • 97.
  • 98. Its purpose is to relieve the developer from a significant amount of relational data persistence-related programming tasks.
  • 99. The main advantages of Hibernate is that maps database entities to objects and hides the details of the data access from the business logic.
  • 100.
  • 101.
  • 102. This validator (or constraint) will not only validate the values but can also validate the size of the data before being persisted.
  • 103. Sample constraint annotations:public class Address { [NotNull] private string name; // Cannot be null [NotNull] [Length(Max = 5, Message = "{long}")] [Pattern(Regex = "[0-9]+")]// Regex for Digits private string zip; // 5 digits
  • 104.
  • 105.
  • 106.
  • 107. The problem with using Javascript is the same as its purpose, the script can execute any script in the HTML browser, however, it may also execute any script put into its place.
  • 108. Hackers can use Javascript to alert the browser to go to a different website, input some extra data, or even access data on the browser itself like browser cookies or the session information in the browser.
  • 109. The hacker takes advantage of changing the information in the <script> … </script> tags.
  • 110.
  • 111.
  • 112. If it has to be turned off because of legitimate reasons, it can be replaced by coding pieces of the Anti-XSS 3.1 library.
  • 113.
  • 114. The XSS Library can be broken down into two pieces, a library of protection routines (using Microsoft.Security.Application) and also a a Security Runtime Engine (SRE) Configuration Utility.
  • 115. The library routines will Encode the output so that it will not execute if passing from an external field.
  • 116.
  • 117. XSS Microsoft Security Application(object viewer)
  • 118.
  • 119.
  • 120.
  • 121.
  • 122. Different types of XSS have evolved so that new ones are being discovered in the wild constantly.
  • 123.
  • 124.
  • 125. The benefit to the attacker, is that if a hidden image is injected into a user’s browser, and their browser currently has their bank authentication cookie, then the hacker may hijack the victims authentication.
  • 126.
  • 127. A reference could be many items like an “image (<img>)” or even an XMLHTTP object. http://www.cgisecurity.com/csrf-faq.htm
  • 128.
  • 129.
  • 130.
  • 131.
  • 132.
  • 133.
  • 134.
  • 135.
  • 136.
  • 137.
  • 138.
  • 139.
  • 140. Information on it can be found at http://json.org/ .
  • 141. JSON is sometimes used in transfer of data, like in Ajax, instead of XML.
  • 142. JSON is used instead of XML because it has a smaller file footprint and can be read easily into Javascript.
  • 143. JSON is normally defined by using the mime type “application/json” and also by using the file type “.json”.
  • 144.
  • 145. Data is usually retrieved using the XMLHttpRequest (XHR) object from the server asynchronously.
  • 146. Javascript (ECMAScript) is used for local processing, and the Document Object Model (DOM) is used to access the data inside the page or read XML from the server. This means that the browser only sends and receives the parts that it needs to change and tries to process some data locally.
  • 147. Ajax is server agnostic.
  • 148.
  • 149.
  • 150. The browser has to interpret the Javascript regardless of how it is encoded and decoded. If a browser can read the Javascript, then the Javascript can be debugged/monitored and manipulated using a JavaScript reverser to intercept the functions.
  • 151. The defense is to validate the Server code.
  • 152.
  • 153. JQuery is the most popular JavaScript library in use today.
  • 154.
  • 155.
  • 158.
  • 159.
  • 160. Flex uses the Flash plugin for running it’s GUI program. http://flex.org/
  • 161. Silverlight programs use the Silverlightplugin for running its environment. http://www.silverlight.net/
  • 162. So the hacking tools normally have to have the plugin in the client as well to talk to these technologies, including Web Scanners.
  • 163. Many of the attacks will now not only be limited to the Flex or Silverlightdeployement but also to the plugin as well.
  • 164.
  • 165. They both can communicate and work with Javascript, therefore they could be susceptible to any XSS form of attack.
  • 166.
  • 167. Flex uses MXML, the Macromedia XML, as a declarative layout of the interfaces to compile into the SWF file that is deployed.
  • 168. To extend the MXML, Flex uses a language called ActionScript, which is similar to Java. ActionScript can be called from the MXML file using the <mx:script> tag.
  • 169.
  • 172.
  • 173. Microsoft offers stripped down versions of Visual Studio to get started with Silverlight from http://www.silverlight.net/getstarted/ .
  • 174.
  • 175. The browser loads the Silverlight plug-in.
  • 176. It then downloads the XAP file that contains your application. This file uses the standard .zip compression.
  • 177. The Silverlight plug-in reads the AppManifest.xml file from the XAP to find out what assemblies your application uses. It creates the Silverlight runtime environment and then loads your application assembly (along with any dependent assemblies).
  • 178. The Silverlight plug-in creates an instance of your custom application class (which is defined in the App.xaml and App.xaml.cs files).
  • 179. The default constructor of the application class raises the Startup event.
  • 180. Your application handles the Startup event and creates the root visual object for your application.
  • 181.
  • 182. SilverlightApplication3TestPage.aspx – This is a ASP page that will need to be deployed on a Web server to test the Silverlight project SilverlightApplication3. This can be used a entry point into the Silverlight Application.
  • 183. SilverlightApplication1TestPage.html – This is a HTML page that will need to be deployed on a Web server to test the Silverlight project SilverlightApplication3. This can be used a entry point into the Silverlight Application.
  • 184.
  • 186.
  • 187.
  • 188.
  • 189.
  • 190.
  • 191.
  • 192. When a system is in production, and especially on the Internet, there is no guarantee that you know who is watching the data transmitted between the user and the server. This may also apply to the Local Area Network as well.
  • 193. Never take it for granted that access cannot be broken.
  • 194. Always, use common algorithms that come with Java. Common algorithms are tested well and are vetted by millions.
  • 195. Keep the keys as secure as the data, because they can unlock the data.
  • 196.
  • 197. The one-way hash generates a fixed size hash some given any size data.
  • 198. The data cannot be reversed engineered from the hash, hence one-way.
  • 199. The same data generates the same hash sum.
  • 200. Different data generates different hash sums.(Note: In rare cases, collisions, different data generates the same sum).
  • 201.
  • 202. The 128 bit hash sum can be used to ensure if there has been tampering of data or a file.
  • 203.
  • 204.
  • 205.
  • 206.
  • 207. The Rijndael algorithm was selected, developed by two Belgian cryptographers, Joan Daemen and Vincent Rijmen.
  • 208. The NIST adapted the variable key space into 128, 192, or 256 bits as FIPS 197 and called it AES.
  • 209.
  • 210. The Asymmetric algorithm can generate key pairs, one private key for encrypting, and its pair is handed out for decryption to more people, the public key.
  • 211.
  • 212. RSA Keys, a simple encrypt/decrypt public key = (e, n) = (17, 3233) private key = (d, n) = ( 2753, 3233) To compute the ciphertext we use C = Pe (mod n). For example, P = 65 and is the letter ‘H’. C = 2790 = 6517 mod 3233.   Back to Plaintext, P = Cd mod n. P = 65 = 27902753 mod 3233. Which returns 65 for ‘H’.  
  • 214. C# RSA Keys (output of private)
  • 217.
  • 218. A larger, combined, piece is the Digital Certificate.
  • 219. A Digital Certificate is a protocol X509 structure that contains verification of the certificate, Non-repudiation (proof of receipt), and third party authentication through a Certificate Authority.
  • 220. The Digital Certificate is the heart of Hypertext Transfer Protocol over Secure Socket Layer (HTTPS) and Public Key Infrastructure (PKI).
  • 221. PKI is the process of authentication through a trusted party called Certificate Authority (CA). This could be a third party or self signed internally through a domain controller.
  • 222.
  • 223.
  • 224.
  • 225. Websites can get accessed by typing in “admin” “admin” at times, and auditors try a range of default and well known logins.
  • 226.
  • 227.
  • 228. The eXtensible Markup Language (XML) defines the interfaces and content of the message.
  • 229.
  • 230.
  • 231. UDDI provides for discovery of services and retrieval of their WSDL descriptions as a directory service. This service may require authentication and encrypt the HTTP protocol.
  • 232. The UDDI will return the WSDL and forward the client to the proxy that will contain the service, usually in the form of a URL.
  • 233. The WSDL will define the acceptable interface into the SOA.
  • 234. The client SOAP call will format the acceptable XML. SOAP will act as an envelope to the SOA.
  • 235. The SOA will accept the call if it meets the WSDL criteria and process the call.
  • 236.
  • 238.
  • 239.
  • 240.
  • 241. Microsoft extends this framework with the Windows Communication Framework (WCF).
  • 242. A guide for writing Secure Web Services can be found at http://wcfsecurityguide.codeplex.com/releases/view/15892
  • 243. Like other frameworks, for example Apache’s Axis2, WCF also supports Authentication, Authorization, Secure Transport, Tokens and Signatures in Web Services. The difference is that WCF is fully integrated into .NET.
  • 244.
  • 245. The Address is the server endpoints being exposed.
  • 246. There are several types of bindings, Http, MSMQ, TCP, etc. These are the communication protocols being used, for instance SOAP over TCP. The Bindings help support end-to-end security for the Web Service.
  • 247. The contract is the service contract that the service will expose for the various clients.
  • 248. WCF also is strongly typed, or even untyped messaging, built on top of .NET.
  • 249.
  • 250.
  • 251.
  • 252.
  • 253.
  • 254.
  • 255.
  • 256. Start by creating a Console Application in C#, then add the “System.ServiceModel” reference and associated “using System.ServiceModel” in the Program.cs.
  • 257. Generate a proxy with the svcutil:
  • 258. Add the generated proxy, generatedProxy.cs and app.config, to the console application.
  • 259.
  • 260.
  • 261. We make a certificate for the localhost:
  • 262.
  • 263.
  • 264. The difference between hacking Web Services, is that the attacks are transmitted in the XML field, which is similar to HTML, instead of an HTML form field.
  • 265. In other words, the XML must be parsed out to enter an attack in the “username” text field in the XML format instead of the “username” GUI form field in HTML.
  • 266.
  • 267. It uses path to traverse traverse through the nodes of an XML document to look for specific information.
  • 268. Xpath injection is similar to SQL injection except that the query strings are slightly different and it uses XML as its attack vector.
  • 269. One example is to pass ‘ or 1=1 or ‘ ‘=‘ as the username to fake the database into a valid username:
  • 270. string(//user[name/text()='' or 1=1 or ''='' and password/text()='foobar']/account/text())
  • 271.
  • 272.
  • 273. Security Testing -FXCop -CAT.NET -Nunit -HTMLUnit -Seleniumin
  • 274.
  • 275. In this case, this is also known as Static Analysis.
  • 276. These tools can find issues with the source code before the code is actually executed.
  • 277.
  • 278.
  • 279.
  • 281. These tools can find issues with the source code before the code is actually executed.
  • 282.
  • 283.
  • 284. Can replicate a real world browser.
  • 286. Provides low-level control over the HTML and HTTP.
  • 287.
  • 290. Run “ikvmc –out:htmlunit-2.7.dll *.jar”
  • 291. Include the htmlunit, IKVM.OpenJDK, and nunitdll’s in the external assemblies.
  • 293. Provides low-level control over the HTML and HTTP.
  • 294.
  • 295. HTMLUnit allows a “getPage()” routine to examine the HTML source code.
  • 296. This allows the walking through of “HREF”, images, and others pieces of the HTML code before executing on the item.
  • 297. Selenium IDE is another Open Source concept that is a Integrated Development Environment running on top of the FireFox browser as a plugin.
  • 298. This allows a recording of the browser actions that can be played back execute buttons being pushed and actions inside the browser.
  • 299. Assertions can be executed on the HTML pages itself for checking specific information.
  • 300.
  • 301. HtmlUnit on C# (Nunit Test) (Under Construction page)
  • 302. HtmlUnit on C# (Nunit Test) (Page not found)
  • 303.
  • 305. This allows a recording of the browser actions that can be played back execute buttons being pushed and actions inside the browser.
  • 306. Assertions can be executed on the HTML pages itself for checking specific information.
  • 307.
  • 308.
  • 309.
  • 310.
  • 311. When an incident happens, the first questions are always “How did they get in?” and “What data was compromised?”.
  • 312. The least favorite answer is usually “No one knows.”
  • 313. With efficient logging of authorization, access to secure information, and any anomalous interaction with the system, a proper recovery of the system is usually insured.
  • 314. The logs should be store into a different system in case the Web system is ever compromised, one where the Web system sends them but never asks for them back.
  • 315.
  • 316. The C# Logger output….
  • 317.
  • 318. There are 3 components of handling an exception, and they are the “try”, “catch” and “finally” blocks.
  • 319. The “try” block will throw an exception from normal code, the “catch” block will catch the exception and handle it, and the “finally” block will process the cleanup afterwards.
  • 320. The “catch” block can log the anomaly, stop the program, or process it in a hundred different ways.
  • 321.
  • 322.
  • 324. Even though the basic CLR logging framework can accept changes on destination through its Handler in the “logging.properties”, Log4Net offers more advanced features in its XML use of its Appender class.
  • 325. Log4Net supports XML configuration and a text configuration in log4Net.properties.
  • 326.
  • 328.
  • 329.
  • 330.
  • 331.
  • 332. An error page giving details, like a database or table name, may be more than enough to give an attacker enough information launch an attack at the website.
  • 333.
  • 334. Send something more generic (based on business input)
  • 335. Web Error pages…. Many web sites use the default error pages that show the user exceptions and even exceptions into the database. The database exceptions have a tendency to display table names and invalid SQL statements that can be used for further probing. To send all errors to a custom Error page, the web.config file for IIS: <customErrors mode="On" defaultRedirect="errors/ErrorPage.aspx"></customErrors>
  • 336.
  • 337.