SlideShare uma empresa Scribd logo
1 de 34
HACKERS VS
DEVELOPERS
Fighting the good fight
HACKER


is one who doesn‟t
play by your rules
HACKER

is one who will gain from making
your app respond in a manner
that you didn’t anticipate
DEVELOPER


is one who creates a
system ; wants the
system to run as
expected
DEVELOPER

almost always doesn‟t think about
attacking the app from the point of
view of someone who wants to
exploit – the app, the resources
supporting the app or the data
hackers
always
  win
so why bother
   fighting?
FIGHTING THE GOOD FIGHT

hackers need only one opening,
 one weakness.
developers need to constantly
 ensure that the security and the
 integrity of the application is
 maintained
RA.ONE VERSUS G.ONE

developers will defend and the
 hackers will attack
the good fight is about making
 secure apps, keeping them
 secure in operation and
 safeguarding user data
HACKERS ARE NECESSARY AND NOT
EVIL

hackers and developers
represent duality. Without
pesky hackers developers
mayn‟t have the incentive to
keep making secure
applications.
SECURE WEB
PROGRAMMIN
G
SOMETHING TO THINK ABOUT
 95% of attacks are against “Web Servers and Web
  Applications” aka Websites
 The top 3 verticals compromised were Financial
  Services, Hospitality and Retail.
 More than 60% of attacks were caused by external
  agents.
 Primary attack vector was SQL Injection and was used
  to install customized malware.
 Injection Attacks are #1 critical flaw in applications

  Sources Verizon DBIR 2010, Whitehat Sec Statistics, OWASP Top 10
                               2010
WEB APP ARCHITECTURE – 3
TIER
      USER AGENTS
                                           WEB SERVERS
      User Agent / Client. Browser, BOT,
      Program Sends Requests like GET,     Web Server listens for requests and sends
      POST, HEAD, PUT, DELETE              appropriate responses like 200, 404, 403
                                           •Has the programming logic to understand
                                           all types of requests ( PHP/ASP.net)
                                           •Talks to the database




                                                        Database Software
                                                      System MySQL, MSSQL




W EB SECURITY TRAINING © AKASH
MA H A J A N                                                        1 7 T H - 1 9 T H MA Y 2 0 1 0   13
WEB APP ARCHITECTURE DATA VIEW


                         Trusted
     Web                             Data Store
                          Code
     Client             Running on
                          server
                        Web Server

   Un-trusted Input
   hitting the server
                                       Web
   from the client,
                                      Service
   data stores, web
   services.
WEB APP ARCHITECTURE – DATA VIEW

The only piece we can trust is the code
 running on the server.
Any data coming to the server, regardless
 of where it originated from shouldn‟t be
 trusted.
Data should only be trusted once it has
 been validated by some piece of trusted
 code.
WEB APP ARCHITECTURE – DATA VIEW

Trusted code is the code which we know
 for sure is the same thing that was
 developed and the integrity is
 maintained.
Based on the validation we can classify
 data as tainted/bad or un-tainted/good.
Only after that the data which is good
 data for the application should be
 processed.
WHERE ALL IS THE DATA COMING
        FROM?
         GET Requests
         POST Requests, HTML Form data
         Cookies stored
         HTTP Headers
         File Uploads
         RSS feeds
         External data-stores or web services




@ MA K A S H | A K A S H M. C O M | T H A T W E B
APPLICATION SECURITY GUY
DATA FLOWS

Four main data flows in any web
 application
   Data from request going to be displayed in the
    browser
   Data from the request going to be stored in the
    database
   Data from the response ( from the database ) going
    to be displayed in the browser
   Data from request going to call a remote
    method/API or read/write something on the server
DATA YOU CAN‟T TRUST
          Good data for a login page
                  Username – foo
                  Password – bar
          Bad data for a login page
                  Username – foo‟ OR 1=1;--
                  Password – bar‟ OR 1=1;--
          Good data for a comment
                  This is a nice comment
          Bad data for a comment
                  This is an XSS</textarea><script>alert(document.cookie);</script>




@ MA K A S H | A K A S H M. C O M - T H A T W E B
APPLICATION SECURITY GUY
DATA YOU NEED TO PROTECT

          Clear text passwords for a username
           email@example.com
          Password is 123456
          Data thief steals the entire database and has reusable
           account details
          http://somebank.cxm/account-details.php?id=1234
          Did you check that only user with id 1234 can see this?
          What if the attacker stole the session cookie of user
           with id 1234



@ MA K A S H | A K A S H M. C O M - T H A T W E B
APPLICATION SECURITY GUY
WHAT IS THE RISK?

Data view of the web app
 shows two places of attack
 Attacking the web application
 Attacking the users of the said
  web application
TYPES OF ATTACKS

          All these attack the web application hosted and
           running on the web server
          Injection attacks
                  SQL Injection – attacking the database
                  Command Injection – attacking the system

          File Inclusion attacks
                  Local File Inclusion
                  Remote File Inclusion

          HTTP Response Splitting – attacking HTTP




@ MA K A S H | A K A S H M. C O M | T H A T W E B
APPLICATION SECURITY GUY
ATTACKING THE WEB APP USER

         All these attacks are meant to attack the user
          of the web application through it.
         Cross Site Scripting or commonly known as
          XSS
         Cross Site Request Forgery also called Sea-
          Surf
         Broken Authentication and Sessions
          Management


@ MA K A S H | A K A S H M. C O M | T H A T W E B
APPLICATION SECURITY GUY
WHY SHOULD WE MAKE SECURE WEB
APPS
Malicious users, automated programs,
 ignorant users are all trying to break your
 web application as we speak.
Web applications which get hacked, go
 down or fail while being used bring
 disrepute to your company, can attract
 financial damages and can be used to
 attack other targets on the web.
HOW DO WE MAKE SECURE WEB
APPS
Always do server side validation.
Any and every data point that originates from
 outside your web application is bad unless
 proved otherwise.
GET, POST, COOKIE, FILES all requests are
 bad.
So we need to ensure only trusted good data
 is processed, is allowed in the database and is
 rendered by the browser.
INTEGRITY OF A WEB
APPLICATION
As the developer you need to ensure that your
 web application has integrity. The data that
 flows through it is known, can be trusted and
 improper data is dealt with in a known way.
 You can do with error handlers, exception
 handling and failing gracefully.
If you look at it holistically the entire point of
 your web app is to shovel data from one point
 to another and do cool things with it.
CROSS SITE SCRIPTING - XSS

Injecting HTML/JS into the site.
   Non-persistent/Reflected/First Order
     Script is taken from the request and displayed in the
      browser directly
     example.com/search?q=<script>alert(„hi‟);</script>

   Persistent/Stored/Second Order
     First name of a registration form is vuln and the value is
      stored in the database
     Hello <iframe src=http://f1y.in/0.js></iframe>
XSS MITIGATION IN ASP.NET 2.0
 Constrain input and Encode output
 For inputs through server controls use validate controls like
    RegularExpressionValidator
    RangeValidator
 For inputs from query strings, cookies, client side HTML
    System.Text.RegularExpressions.Regex class
 Encode output for html. Convert < to &lt; “ to &quot;
    HttpUtility.HtmlEncode
    Response.Write(HttpUtility.HtmlEncode(Request.Form[“foo"]));
 Encode output for urls created from user input
XSS MITIGATION IN ASP.NET 2.0
    HttpUtility.UrlEncode
    Response.Write(HttpUtility.UrlEncode(urlString));

 Check that request validation is enabled in Machine.config and is
  not overwritten by the Web.config
    <system.web> <pages buffer="true" validateRequest="true" /> </system.web>
    You can set it to false for certain pages which might require rich text
      processing.
 Client headers like user agent can be malicious as well.
 Thumb rule, if its not your data consider it bad. If you can verify it,
  consider it trusted good data.
 White listing helps in verifying good data more than black listing.
 See examples at xssed.com
 Try out MS Anti XSS Library http://www.codeplex.com/AntiXSS
XSS MITIGATION IN PHP
 Sanitize all globals ($_GET, $_POST, $_COOKIE)
    Use strip_tags()
    Use inpekt library code.google.com/p/inspekt
 Escape everything before displaying
    htmlentities(), htmlspeciachars()
 Client headers like user agent can be malicious as well.
 Thumb rule, if its not your data consider it bad. If you can verify it,
  consider it trusted good data.
 White listing helps in verifying good data more than black listing.
 See examples at xssed.com
SQL INJECTION

 Allowing SQL to be injected in the database query.
 Most common attack point is the search of any
  dynamic website and registration forms. These two will
  be definitely talking to the database.
 $sql = "SELECT * FROM table WHERE id = '" .
  Request.QueryString[„id‟] . "'";
 id = ' ; DROP DATABASE pubs –
 Excellent examples
  http://google.com/search?q=site:slideshare.net sql
  injection
SQL INJECTION - MITIGATION
 Sanitize input data. Check for lengths & types
 Use type safe SQL parameterized queries for stored procedures
  or dynamic SQL queries
    Parameter collection SqlParameterCollection
   using (SqlConnection connection = new SqlConnection(connectionString))
   {
       DataSet userDataset = new DataSet();
       SqlDataAdapter myCommand = new SqlDataAdapter(
             "LoginStoredProcedure", connection);
       myCommand.SelectCommand.CommandType =
        CommandType.StoredProcedure;
SQL INJECTION - MITIGATION
        myCommand.SelectCommand.Parameters.Add("@name", SqlDbType.VarChar, 40);
        myCommand.SelectCommand.Parameters["@name"].Value =
         Request.QueryString[„name‟];
        myCommand.Fill(userDataset);
    }
 Avoid disclosing database error information
     <customErrors mode="remoteOnly" />
     <customErrors mode="On" defaultRedirect=“ErrorPage.htm" />

 See a kickass example of stored proc used to hack more than hundred
  thousand websites
     http://www.breach.com/resources/breach-security-labs/alerts/mass-sql-injection-attack-
          evolution
 MS Source Code Analyzer to SQL Injection
     http://www.microsoft.com/downloads/details.aspx?familyid=58A7C46E-A599-4FCB-
          9AB4-A4334146B6BA&displaylang=en
SQL INJECTION - MITIGATION
 mysql_real_escape_string()
    $dbquery = sprintf(“SELECT name FROM user WHERE id=„%s‟”,
     mysql_real_escape_string(„id‟));
 Parameterized queries
    $res = $query(“SELECT name FROM user WHERE id=?”, $id);
    Standard mysql module in PHP doesn‟t allow for parameterized queries. You
     need mysqli
 Stored Procedures
    See a kickass example of stored proc used to hack more than hundred
     thousand websites
        http://www.breach.com/resources/breach-security-labs/alerts/mass-sql-injection-
          attack-evolutio

Mais conteúdo relacionado

Mais procurados

Web Services Hacking and Security
Web Services Hacking and SecurityWeb Services Hacking and Security
Web Services Hacking and SecurityBlueinfy Solutions
 
Hacking Ajax & Web Services - Next Generation Web Attacks on the Rise
Hacking Ajax & Web Services - Next Generation Web Attacks on the RiseHacking Ajax & Web Services - Next Generation Web Attacks on the Rise
Hacking Ajax & Web Services - Next Generation Web Attacks on the RiseShreeraj Shah
 
Next Generation Web Attacks – HTML 5, DOM(L3) and XHR(L2)
Next Generation Web Attacks – HTML 5, DOM(L3) and XHR(L2)Next Generation Web Attacks – HTML 5, DOM(L3) and XHR(L2)
Next Generation Web Attacks – HTML 5, DOM(L3) and XHR(L2)Shreeraj Shah
 
Top 10 Web App Security Risks
Top 10 Web App Security RisksTop 10 Web App Security Risks
Top 10 Web App Security RisksSperasoft
 
React security vulnerabilities
React security vulnerabilitiesReact security vulnerabilities
React security vulnerabilitiesAngelinaJasper
 
Application Security Part 1 Threat Defense In Client Server Applications ...
Application Security   Part 1   Threat Defense In Client Server Applications ...Application Security   Part 1   Threat Defense In Client Server Applications ...
Application Security Part 1 Threat Defense In Client Server Applications ...Greg Sohl
 
Exploiting parameter tempering attack in web application
Exploiting parameter tempering attack in web applicationExploiting parameter tempering attack in web application
Exploiting parameter tempering attack in web applicationVishal Kumar
 
A8 cross site request forgery (csrf) it 6873 presentation
A8 cross site request forgery (csrf)   it 6873 presentationA8 cross site request forgery (csrf)   it 6873 presentation
A8 cross site request forgery (csrf) it 6873 presentationAlbena Asenova-Belal
 
Hacking Web 2.0 - Defending Ajax and Web Services [HITB 2007 Dubai]
Hacking Web 2.0 - Defending Ajax and Web Services [HITB 2007 Dubai]Hacking Web 2.0 - Defending Ajax and Web Services [HITB 2007 Dubai]
Hacking Web 2.0 - Defending Ajax and Web Services [HITB 2007 Dubai]Shreeraj Shah
 
Become a Security Ninja
Become a Security NinjaBecome a Security Ninja
Become a Security NinjaPaul Gilzow
 
[Infosecworld 08 Orlando] CSRF: The Biggest Little Vulnerability on the Web
[Infosecworld 08 Orlando] CSRF: The Biggest Little Vulnerability on the Web [Infosecworld 08 Orlando] CSRF: The Biggest Little Vulnerability on the Web
[Infosecworld 08 Orlando] CSRF: The Biggest Little Vulnerability on the Web Shreeraj Shah
 
Web Attacks - Top threats - 2010
Web Attacks - Top threats - 2010Web Attacks - Top threats - 2010
Web Attacks - Top threats - 2010Shreeraj Shah
 
Mobile code mining for discovery and exploits nullcongoa2013
Mobile code mining for discovery and exploits nullcongoa2013Mobile code mining for discovery and exploits nullcongoa2013
Mobile code mining for discovery and exploits nullcongoa2013Blueinfy Solutions
 
Owasp top 10 web application security hazards part 2
Owasp top 10 web application security hazards part 2Owasp top 10 web application security hazards part 2
Owasp top 10 web application security hazards part 2Abhinav Sejpal
 
FIND ME IF YOU CAN – SMART FUZZING AND DISCOVERY
FIND ME IF YOU CAN – SMART FUZZING AND DISCOVERYFIND ME IF YOU CAN – SMART FUZZING AND DISCOVERY
FIND ME IF YOU CAN – SMART FUZZING AND DISCOVERYShreeraj Shah
 
Owasp top 10 web application security hazards - Part 1
Owasp top 10 web application security hazards - Part 1Owasp top 10 web application security hazards - Part 1
Owasp top 10 web application security hazards - Part 1Abhinav Sejpal
 
A security note for web developers
A security note for web developersA security note for web developers
A security note for web developersJohn Ombagi
 

Mais procurados (20)

Web Services Hacking and Security
Web Services Hacking and SecurityWeb Services Hacking and Security
Web Services Hacking and Security
 
Hacking Ajax & Web Services - Next Generation Web Attacks on the Rise
Hacking Ajax & Web Services - Next Generation Web Attacks on the RiseHacking Ajax & Web Services - Next Generation Web Attacks on the Rise
Hacking Ajax & Web Services - Next Generation Web Attacks on the Rise
 
Security 101
Security 101Security 101
Security 101
 
Next Generation Web Attacks – HTML 5, DOM(L3) and XHR(L2)
Next Generation Web Attacks – HTML 5, DOM(L3) and XHR(L2)Next Generation Web Attacks – HTML 5, DOM(L3) and XHR(L2)
Next Generation Web Attacks – HTML 5, DOM(L3) and XHR(L2)
 
Top 10 Web App Security Risks
Top 10 Web App Security RisksTop 10 Web App Security Risks
Top 10 Web App Security Risks
 
React security vulnerabilities
React security vulnerabilitiesReact security vulnerabilities
React security vulnerabilities
 
Application Security Part 1 Threat Defense In Client Server Applications ...
Application Security   Part 1   Threat Defense In Client Server Applications ...Application Security   Part 1   Threat Defense In Client Server Applications ...
Application Security Part 1 Threat Defense In Client Server Applications ...
 
Exploiting parameter tempering attack in web application
Exploiting parameter tempering attack in web applicationExploiting parameter tempering attack in web application
Exploiting parameter tempering attack in web application
 
A8 cross site request forgery (csrf) it 6873 presentation
A8 cross site request forgery (csrf)   it 6873 presentationA8 cross site request forgery (csrf)   it 6873 presentation
A8 cross site request forgery (csrf) it 6873 presentation
 
Hacking Web 2.0 - Defending Ajax and Web Services [HITB 2007 Dubai]
Hacking Web 2.0 - Defending Ajax and Web Services [HITB 2007 Dubai]Hacking Web 2.0 - Defending Ajax and Web Services [HITB 2007 Dubai]
Hacking Web 2.0 - Defending Ajax and Web Services [HITB 2007 Dubai]
 
Become a Security Ninja
Become a Security NinjaBecome a Security Ninja
Become a Security Ninja
 
[Infosecworld 08 Orlando] CSRF: The Biggest Little Vulnerability on the Web
[Infosecworld 08 Orlando] CSRF: The Biggest Little Vulnerability on the Web [Infosecworld 08 Orlando] CSRF: The Biggest Little Vulnerability on the Web
[Infosecworld 08 Orlando] CSRF: The Biggest Little Vulnerability on the Web
 
Web Attacks - Top threats - 2010
Web Attacks - Top threats - 2010Web Attacks - Top threats - 2010
Web Attacks - Top threats - 2010
 
Owasp web security
Owasp web securityOwasp web security
Owasp web security
 
Mobile code mining for discovery and exploits nullcongoa2013
Mobile code mining for discovery and exploits nullcongoa2013Mobile code mining for discovery and exploits nullcongoa2013
Mobile code mining for discovery and exploits nullcongoa2013
 
Owasp top 10 web application security hazards part 2
Owasp top 10 web application security hazards part 2Owasp top 10 web application security hazards part 2
Owasp top 10 web application security hazards part 2
 
FIND ME IF YOU CAN – SMART FUZZING AND DISCOVERY
FIND ME IF YOU CAN – SMART FUZZING AND DISCOVERYFIND ME IF YOU CAN – SMART FUZZING AND DISCOVERY
FIND ME IF YOU CAN – SMART FUZZING AND DISCOVERY
 
Owasp top 10 web application security hazards - Part 1
Owasp top 10 web application security hazards - Part 1Owasp top 10 web application security hazards - Part 1
Owasp top 10 web application security hazards - Part 1
 
A security note for web developers
A security note for web developersA security note for web developers
A security note for web developers
 
Session7-XSS & CSRF
Session7-XSS & CSRFSession7-XSS & CSRF
Session7-XSS & CSRF
 

Destaque

PHP Backdoor: The rise of the vuln
PHP Backdoor: The rise of the vulnPHP Backdoor: The rise of the vuln
PHP Backdoor: The rise of the vulnSandro Zaccarini
 
How To Avoid The Top Ten Software Security Flaws
How To Avoid The Top Ten Software Security FlawsHow To Avoid The Top Ten Software Security Flaws
How To Avoid The Top Ten Software Security FlawsPriyanka Aash
 
Php web backdoor obfuscation
Php web backdoor obfuscationPhp web backdoor obfuscation
Php web backdoor obfuscationSandro Zaccarini
 
PHP and Application Security - OWASP Road Show 2013
PHP and Application Security - OWASP Road Show 2013PHP and Application Security - OWASP Road Show 2013
PHP and Application Security - OWASP Road Show 2013rjsmelo
 
Essentials of Web Application Security: what it is, why it matters and how to...
Essentials of Web Application Security: what it is, why it matters and how to...Essentials of Web Application Security: what it is, why it matters and how to...
Essentials of Web Application Security: what it is, why it matters and how to...Cenzic
 
Security In PHP Applications
Security In PHP ApplicationsSecurity In PHP Applications
Security In PHP ApplicationsAditya Mooley
 
A Simple Laboratory Environment for Real World Offensive Security Education
A Simple Laboratory Environment for Real World Offensive Security EducationA Simple Laboratory Environment for Real World Offensive Security Education
A Simple Laboratory Environment for Real World Offensive Security Educationchunkybacon
 
Hacking Your Way to Better Security - PHP South Africa 2016
Hacking Your Way to Better Security - PHP South Africa 2016Hacking Your Way to Better Security - PHP South Africa 2016
Hacking Your Way to Better Security - PHP South Africa 2016Colin O'Dell
 
Security in PHP Applications: An absolute must!
Security in PHP Applications: An absolute must!Security in PHP Applications: An absolute must!
Security in PHP Applications: An absolute must!Mark Niebergall
 
Application Security on a Dime: A Practical Guide to Using Functional Open So...
Application Security on a Dime: A Practical Guide to Using Functional Open So...Application Security on a Dime: A Practical Guide to Using Functional Open So...
Application Security on a Dime: A Practical Guide to Using Functional Open So...POSSCON
 
Nullcon Jailbreak CTF 2012,Walkthrough by Team Loosers
Nullcon Jailbreak CTF 2012,Walkthrough by Team LoosersNullcon Jailbreak CTF 2012,Walkthrough by Team Loosers
Nullcon Jailbreak CTF 2012,Walkthrough by Team LoosersAjith Chandran
 
Web application security
Web application securityWeb application security
Web application securityKapil Sharma
 
Web Application Security
Web Application SecurityWeb Application Security
Web Application SecurityChris Hillman
 
Security Testing by Ken De Souza
Security Testing by Ken De SouzaSecurity Testing by Ken De Souza
Security Testing by Ken De SouzaQA or the Highway
 
Remote File Inclusion (RFI) Vulnerabilities 101
Remote File Inclusion (RFI) Vulnerabilities 101Remote File Inclusion (RFI) Vulnerabilities 101
Remote File Inclusion (RFI) Vulnerabilities 101Imperva
 

Destaque (20)

PHP Backdoor: The rise of the vuln
PHP Backdoor: The rise of the vulnPHP Backdoor: The rise of the vuln
PHP Backdoor: The rise of the vuln
 
How To Avoid The Top Ten Software Security Flaws
How To Avoid The Top Ten Software Security FlawsHow To Avoid The Top Ten Software Security Flaws
How To Avoid The Top Ten Software Security Flaws
 
Php security
Php securityPhp security
Php security
 
Php web backdoor obfuscation
Php web backdoor obfuscationPhp web backdoor obfuscation
Php web backdoor obfuscation
 
PHP and Application Security - OWASP Road Show 2013
PHP and Application Security - OWASP Road Show 2013PHP and Application Security - OWASP Road Show 2013
PHP and Application Security - OWASP Road Show 2013
 
Essentials of Web Application Security: what it is, why it matters and how to...
Essentials of Web Application Security: what it is, why it matters and how to...Essentials of Web Application Security: what it is, why it matters and how to...
Essentials of Web Application Security: what it is, why it matters and how to...
 
Security In PHP Applications
Security In PHP ApplicationsSecurity In PHP Applications
Security In PHP Applications
 
A Simple Laboratory Environment for Real World Offensive Security Education
A Simple Laboratory Environment for Real World Offensive Security EducationA Simple Laboratory Environment for Real World Offensive Security Education
A Simple Laboratory Environment for Real World Offensive Security Education
 
Hacking Your Way to Better Security - PHP South Africa 2016
Hacking Your Way to Better Security - PHP South Africa 2016Hacking Your Way to Better Security - PHP South Africa 2016
Hacking Your Way to Better Security - PHP South Africa 2016
 
LFI to RCE
LFI to RCELFI to RCE
LFI to RCE
 
PHP Secure Programming
PHP Secure ProgrammingPHP Secure Programming
PHP Secure Programming
 
Security in PHP Applications: An absolute must!
Security in PHP Applications: An absolute must!Security in PHP Applications: An absolute must!
Security in PHP Applications: An absolute must!
 
Application Security on a Dime: A Practical Guide to Using Functional Open So...
Application Security on a Dime: A Practical Guide to Using Functional Open So...Application Security on a Dime: A Practical Guide to Using Functional Open So...
Application Security on a Dime: A Practical Guide to Using Functional Open So...
 
Nullcon Jailbreak CTF 2012,Walkthrough by Team Loosers
Nullcon Jailbreak CTF 2012,Walkthrough by Team LoosersNullcon Jailbreak CTF 2012,Walkthrough by Team Loosers
Nullcon Jailbreak CTF 2012,Walkthrough by Team Loosers
 
Web application security
Web application securityWeb application security
Web application security
 
Web Application Security
Web Application SecurityWeb Application Security
Web Application Security
 
Nikto
NiktoNikto
Nikto
 
Security Testing by Ken De Souza
Security Testing by Ken De SouzaSecurity Testing by Ken De Souza
Security Testing by Ken De Souza
 
Php web app security (eng)
Php web app security (eng)Php web app security (eng)
Php web app security (eng)
 
Remote File Inclusion (RFI) Vulnerabilities 101
Remote File Inclusion (RFI) Vulnerabilities 101Remote File Inclusion (RFI) Vulnerabilities 101
Remote File Inclusion (RFI) Vulnerabilities 101
 

Semelhante a Hackers versus Developers and Secure Web Programming

Why You Need A Web Application Firewall
Why You Need A Web Application FirewallWhy You Need A Web Application Firewall
Why You Need A Web Application FirewallPort80 Software
 
Developing Secure Applications and Defending Against Common Attacks
Developing Secure Applications and Defending Against Common AttacksDeveloping Secure Applications and Defending Against Common Attacks
Developing Secure Applications and Defending Against Common AttacksPayPalX Developer Network
 
5 step plan to securing your APIs
5 step plan to securing your APIs5 step plan to securing your APIs
5 step plan to securing your APIs💻 Javier Garza
 
Jan 2008 Allup
Jan 2008 AllupJan 2008 Allup
Jan 2008 Allupllangit
 
Pantallas escaneo Sitio Web
Pantallas escaneo Sitio WebPantallas escaneo Sitio Web
Pantallas escaneo Sitio Webandres1422
 
Web Application Security Tips
Web Application Security TipsWeb Application Security Tips
Web Application Security Tipstcellsn
 
Are you fighting_new_threats_with_old_weapons
Are you fighting_new_threats_with_old_weaponsAre you fighting_new_threats_with_old_weapons
Are you fighting_new_threats_with_old_weaponsBhargav Modi
 
2013 OWASP Top 10
2013 OWASP Top 102013 OWASP Top 10
2013 OWASP Top 10bilcorry
 
Website hacking and prevention (All Tools,Topics & Technique )
Website hacking and prevention (All Tools,Topics & Technique )Website hacking and prevention (All Tools,Topics & Technique )
Website hacking and prevention (All Tools,Topics & Technique )Jay Nagar
 
Intro to Web Application Security
Intro to Web Application SecurityIntro to Web Application Security
Intro to Web Application SecurityRob Ragan
 
Solvay secure application layer v2015 seba
Solvay secure application layer v2015   sebaSolvay secure application layer v2015   seba
Solvay secure application layer v2015 sebaSebastien Deleersnyder
 
Application security [appsec]
Application security [appsec]Application security [appsec]
Application security [appsec]Judy Ngure
 
Get Ready for Web Application Security Testing
Get Ready for Web Application Security TestingGet Ready for Web Application Security Testing
Get Ready for Web Application Security TestingAlan Kan
 
OWASP Top 10 List Overview for Web Developers
OWASP Top 10 List Overview for Web DevelopersOWASP Top 10 List Overview for Web Developers
OWASP Top 10 List Overview for Web DevelopersBenjamin Floyd
 
Andrews whitakrer lecture18-security.ppt
Andrews whitakrer lecture18-security.pptAndrews whitakrer lecture18-security.ppt
Andrews whitakrer lecture18-security.pptSilverGold16
 
Secure code practices
Secure code practicesSecure code practices
Secure code practicesHina Rawal
 
Security in the cloud protecting your cloud apps
Security in the cloud   protecting your cloud appsSecurity in the cloud   protecting your cloud apps
Security in the cloud protecting your cloud appsCenzic
 
Web Site vulnerability Sales and Consulting
Web Site vulnerability Sales and ConsultingWeb Site vulnerability Sales and Consulting
Web Site vulnerability Sales and Consultingguest4cee27ac
 

Semelhante a Hackers versus Developers and Secure Web Programming (20)

Why You Need A Web Application Firewall
Why You Need A Web Application FirewallWhy You Need A Web Application Firewall
Why You Need A Web Application Firewall
 
Developing Secure Applications and Defending Against Common Attacks
Developing Secure Applications and Defending Against Common AttacksDeveloping Secure Applications and Defending Against Common Attacks
Developing Secure Applications and Defending Against Common Attacks
 
5 step plan to securing your APIs
5 step plan to securing your APIs5 step plan to securing your APIs
5 step plan to securing your APIs
 
Jan 2008 Allup
Jan 2008 AllupJan 2008 Allup
Jan 2008 Allup
 
Pantallas escaneo Sitio Web
Pantallas escaneo Sitio WebPantallas escaneo Sitio Web
Pantallas escaneo Sitio Web
 
Web Application Security Tips
Web Application Security TipsWeb Application Security Tips
Web Application Security Tips
 
Are you fighting_new_threats_with_old_weapons
Are you fighting_new_threats_with_old_weaponsAre you fighting_new_threats_with_old_weapons
Are you fighting_new_threats_with_old_weapons
 
2013 OWASP Top 10
2013 OWASP Top 102013 OWASP Top 10
2013 OWASP Top 10
 
Website hacking and prevention (All Tools,Topics & Technique )
Website hacking and prevention (All Tools,Topics & Technique )Website hacking and prevention (All Tools,Topics & Technique )
Website hacking and prevention (All Tools,Topics & Technique )
 
Intro to Web Application Security
Intro to Web Application SecurityIntro to Web Application Security
Intro to Web Application Security
 
T04505103106
T04505103106T04505103106
T04505103106
 
Novinky F5 pro rok 2018
Novinky F5 pro rok 2018Novinky F5 pro rok 2018
Novinky F5 pro rok 2018
 
Solvay secure application layer v2015 seba
Solvay secure application layer v2015   sebaSolvay secure application layer v2015   seba
Solvay secure application layer v2015 seba
 
Application security [appsec]
Application security [appsec]Application security [appsec]
Application security [appsec]
 
Get Ready for Web Application Security Testing
Get Ready for Web Application Security TestingGet Ready for Web Application Security Testing
Get Ready for Web Application Security Testing
 
OWASP Top 10 List Overview for Web Developers
OWASP Top 10 List Overview for Web DevelopersOWASP Top 10 List Overview for Web Developers
OWASP Top 10 List Overview for Web Developers
 
Andrews whitakrer lecture18-security.ppt
Andrews whitakrer lecture18-security.pptAndrews whitakrer lecture18-security.ppt
Andrews whitakrer lecture18-security.ppt
 
Secure code practices
Secure code practicesSecure code practices
Secure code practices
 
Security in the cloud protecting your cloud apps
Security in the cloud   protecting your cloud appsSecurity in the cloud   protecting your cloud apps
Security in the cloud protecting your cloud apps
 
Web Site vulnerability Sales and Consulting
Web Site vulnerability Sales and ConsultingWeb Site vulnerability Sales and Consulting
Web Site vulnerability Sales and Consulting
 

Mais de Akash Mahajan

On Writing Well - A talk given at WinjaBlogs Session
On Writing Well - A talk given at WinjaBlogs SessionOn Writing Well - A talk given at WinjaBlogs Session
On Writing Well - A talk given at WinjaBlogs SessionAkash Mahajan
 
App sec in the time of docker containers
App sec in the time of docker containersApp sec in the time of docker containers
App sec in the time of docker containersAkash Mahajan
 
Venom vulnerability Overview and a basic demo
Venom vulnerability Overview and a basic demoVenom vulnerability Overview and a basic demo
Venom vulnerability Overview and a basic demoAkash Mahajan
 
Security in the cloud Workshop HSTC 2014
Security in the cloud Workshop HSTC 2014Security in the cloud Workshop HSTC 2014
Security in the cloud Workshop HSTC 2014Akash Mahajan
 
INCOMPLETE - OUTLINE for RootConf 2014 - The little-servcie-which-wasn't-there
INCOMPLETE - OUTLINE for RootConf 2014 - The little-servcie-which-wasn't-thereINCOMPLETE - OUTLINE for RootConf 2014 - The little-servcie-which-wasn't-there
INCOMPLETE - OUTLINE for RootConf 2014 - The little-servcie-which-wasn't-thereAkash Mahajan
 
The real incident of stealing a droid app+data
The real incident of stealing a droid app+dataThe real incident of stealing a droid app+data
The real incident of stealing a droid app+dataAkash Mahajan
 
Believe It Or Not SSL Attacks
Believe It Or Not SSL AttacksBelieve It Or Not SSL Attacks
Believe It Or Not SSL AttacksAkash Mahajan
 
I haz your mouse clicks and key strokes
I haz your mouse clicks and key strokesI haz your mouse clicks and key strokes
I haz your mouse clicks and key strokesAkash Mahajan
 
Secure HTTP Headers c0c0n 2011 Akash Mahajan
Secure HTTP Headers c0c0n 2011 Akash MahajanSecure HTTP Headers c0c0n 2011 Akash Mahajan
Secure HTTP Headers c0c0n 2011 Akash MahajanAkash Mahajan
 
Secure passwords-theory-and-practice
Secure passwords-theory-and-practiceSecure passwords-theory-and-practice
Secure passwords-theory-and-practiceAkash Mahajan
 
Top 10 web application security risks akash mahajan
Top 10 web application security risks   akash mahajanTop 10 web application security risks   akash mahajan
Top 10 web application security risks akash mahajanAkash Mahajan
 
Web application security
Web application securityWeb application security
Web application securityAkash Mahajan
 
Web application security
Web application securityWeb application security
Web application securityAkash Mahajan
 
Web application security
Web application securityWeb application security
Web application securityAkash Mahajan
 
Secure Programming In Php
Secure Programming In PhpSecure Programming In Php
Secure Programming In PhpAkash Mahajan
 

Mais de Akash Mahajan (16)

On Writing Well - A talk given at WinjaBlogs Session
On Writing Well - A talk given at WinjaBlogs SessionOn Writing Well - A talk given at WinjaBlogs Session
On Writing Well - A talk given at WinjaBlogs Session
 
App sec in the time of docker containers
App sec in the time of docker containersApp sec in the time of docker containers
App sec in the time of docker containers
 
Venom vulnerability Overview and a basic demo
Venom vulnerability Overview and a basic demoVenom vulnerability Overview and a basic demo
Venom vulnerability Overview and a basic demo
 
Security in the cloud Workshop HSTC 2014
Security in the cloud Workshop HSTC 2014Security in the cloud Workshop HSTC 2014
Security in the cloud Workshop HSTC 2014
 
INCOMPLETE - OUTLINE for RootConf 2014 - The little-servcie-which-wasn't-there
INCOMPLETE - OUTLINE for RootConf 2014 - The little-servcie-which-wasn't-thereINCOMPLETE - OUTLINE for RootConf 2014 - The little-servcie-which-wasn't-there
INCOMPLETE - OUTLINE for RootConf 2014 - The little-servcie-which-wasn't-there
 
The real incident of stealing a droid app+data
The real incident of stealing a droid app+dataThe real incident of stealing a droid app+data
The real incident of stealing a droid app+data
 
Believe It Or Not SSL Attacks
Believe It Or Not SSL AttacksBelieve It Or Not SSL Attacks
Believe It Or Not SSL Attacks
 
I haz your mouse clicks and key strokes
I haz your mouse clicks and key strokesI haz your mouse clicks and key strokes
I haz your mouse clicks and key strokes
 
Secure HTTP Headers c0c0n 2011 Akash Mahajan
Secure HTTP Headers c0c0n 2011 Akash MahajanSecure HTTP Headers c0c0n 2011 Akash Mahajan
Secure HTTP Headers c0c0n 2011 Akash Mahajan
 
Secure passwords-theory-and-practice
Secure passwords-theory-and-practiceSecure passwords-theory-and-practice
Secure passwords-theory-and-practice
 
Top 10 web application security risks akash mahajan
Top 10 web application security risks   akash mahajanTop 10 web application security risks   akash mahajan
Top 10 web application security risks akash mahajan
 
Web application security
Web application securityWeb application security
Web application security
 
Web application security
Web application securityWeb application security
Web application security
 
Web application security
Web application securityWeb application security
Web application security
 
Secure Programming In Php
Secure Programming In PhpSecure Programming In Php
Secure Programming In Php
 
Startups Security
Startups SecurityStartups Security
Startups Security
 

Último

presentation ICT roal in 21st century education
presentation ICT roal in 21st century educationpresentation ICT roal in 21st century education
presentation ICT roal in 21st century educationjfdjdjcjdnsjd
 
Corporate and higher education May webinar.pptx
Corporate and higher education May webinar.pptxCorporate and higher education May webinar.pptx
Corporate and higher education May webinar.pptxRustici Software
 
Mcleodganj Call Girls 🥰 8617370543 Service Offer VIP Hot Model
Mcleodganj Call Girls 🥰 8617370543 Service Offer VIP Hot ModelMcleodganj Call Girls 🥰 8617370543 Service Offer VIP Hot Model
Mcleodganj Call Girls 🥰 8617370543 Service Offer VIP Hot ModelDeepika Singh
 
DEV meet-up UiPath Document Understanding May 7 2024 Amsterdam
DEV meet-up UiPath Document Understanding May 7 2024 AmsterdamDEV meet-up UiPath Document Understanding May 7 2024 Amsterdam
DEV meet-up UiPath Document Understanding May 7 2024 AmsterdamUiPathCommunity
 
Platformless Horizons for Digital Adaptability
Platformless Horizons for Digital AdaptabilityPlatformless Horizons for Digital Adaptability
Platformless Horizons for Digital AdaptabilityWSO2
 
DBX First Quarter 2024 Investor Presentation
DBX First Quarter 2024 Investor PresentationDBX First Quarter 2024 Investor Presentation
DBX First Quarter 2024 Investor PresentationDropbox
 
[BuildWithAI] Introduction to Gemini.pdf
[BuildWithAI] Introduction to Gemini.pdf[BuildWithAI] Introduction to Gemini.pdf
[BuildWithAI] Introduction to Gemini.pdfSandro Moreira
 
Apidays New York 2024 - Passkeys: Developing APIs to enable passwordless auth...
Apidays New York 2024 - Passkeys: Developing APIs to enable passwordless auth...Apidays New York 2024 - Passkeys: Developing APIs to enable passwordless auth...
Apidays New York 2024 - Passkeys: Developing APIs to enable passwordless auth...apidays
 
WSO2's API Vision: Unifying Control, Empowering Developers
WSO2's API Vision: Unifying Control, Empowering DevelopersWSO2's API Vision: Unifying Control, Empowering Developers
WSO2's API Vision: Unifying Control, Empowering DevelopersWSO2
 
Introduction to Multilingual Retrieval Augmented Generation (RAG)
Introduction to Multilingual Retrieval Augmented Generation (RAG)Introduction to Multilingual Retrieval Augmented Generation (RAG)
Introduction to Multilingual Retrieval Augmented Generation (RAG)Zilliz
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerThousandEyes
 
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWER
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWEREMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWER
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWERMadyBayot
 
Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...apidays
 
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FMESafe Software
 
Exploring Multimodal Embeddings with Milvus
Exploring Multimodal Embeddings with MilvusExploring Multimodal Embeddings with Milvus
Exploring Multimodal Embeddings with MilvusZilliz
 
Rising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdf
Rising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdfRising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdf
Rising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdfOrbitshub
 
Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...
Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...
Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...Angeliki Cooney
 
ICT role in 21st century education and its challenges
ICT role in 21st century education and its challengesICT role in 21st century education and its challenges
ICT role in 21st century education and its challengesrafiqahmad00786416
 
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...DianaGray10
 
Why Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire businessWhy Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire businesspanagenda
 

Último (20)

presentation ICT roal in 21st century education
presentation ICT roal in 21st century educationpresentation ICT roal in 21st century education
presentation ICT roal in 21st century education
 
Corporate and higher education May webinar.pptx
Corporate and higher education May webinar.pptxCorporate and higher education May webinar.pptx
Corporate and higher education May webinar.pptx
 
Mcleodganj Call Girls 🥰 8617370543 Service Offer VIP Hot Model
Mcleodganj Call Girls 🥰 8617370543 Service Offer VIP Hot ModelMcleodganj Call Girls 🥰 8617370543 Service Offer VIP Hot Model
Mcleodganj Call Girls 🥰 8617370543 Service Offer VIP Hot Model
 
DEV meet-up UiPath Document Understanding May 7 2024 Amsterdam
DEV meet-up UiPath Document Understanding May 7 2024 AmsterdamDEV meet-up UiPath Document Understanding May 7 2024 Amsterdam
DEV meet-up UiPath Document Understanding May 7 2024 Amsterdam
 
Platformless Horizons for Digital Adaptability
Platformless Horizons for Digital AdaptabilityPlatformless Horizons for Digital Adaptability
Platformless Horizons for Digital Adaptability
 
DBX First Quarter 2024 Investor Presentation
DBX First Quarter 2024 Investor PresentationDBX First Quarter 2024 Investor Presentation
DBX First Quarter 2024 Investor Presentation
 
[BuildWithAI] Introduction to Gemini.pdf
[BuildWithAI] Introduction to Gemini.pdf[BuildWithAI] Introduction to Gemini.pdf
[BuildWithAI] Introduction to Gemini.pdf
 
Apidays New York 2024 - Passkeys: Developing APIs to enable passwordless auth...
Apidays New York 2024 - Passkeys: Developing APIs to enable passwordless auth...Apidays New York 2024 - Passkeys: Developing APIs to enable passwordless auth...
Apidays New York 2024 - Passkeys: Developing APIs to enable passwordless auth...
 
WSO2's API Vision: Unifying Control, Empowering Developers
WSO2's API Vision: Unifying Control, Empowering DevelopersWSO2's API Vision: Unifying Control, Empowering Developers
WSO2's API Vision: Unifying Control, Empowering Developers
 
Introduction to Multilingual Retrieval Augmented Generation (RAG)
Introduction to Multilingual Retrieval Augmented Generation (RAG)Introduction to Multilingual Retrieval Augmented Generation (RAG)
Introduction to Multilingual Retrieval Augmented Generation (RAG)
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected Worker
 
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWER
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWEREMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWER
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWER
 
Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...
 
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
 
Exploring Multimodal Embeddings with Milvus
Exploring Multimodal Embeddings with MilvusExploring Multimodal Embeddings with Milvus
Exploring Multimodal Embeddings with Milvus
 
Rising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdf
Rising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdfRising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdf
Rising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdf
 
Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...
Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...
Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...
 
ICT role in 21st century education and its challenges
ICT role in 21st century education and its challengesICT role in 21st century education and its challenges
ICT role in 21st century education and its challenges
 
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
 
Why Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire businessWhy Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire business
 

Hackers versus Developers and Secure Web Programming

  • 2. HACKER is one who doesn‟t play by your rules
  • 3. HACKER is one who will gain from making your app respond in a manner that you didn’t anticipate
  • 4. DEVELOPER is one who creates a system ; wants the system to run as expected
  • 5. DEVELOPER almost always doesn‟t think about attacking the app from the point of view of someone who wants to exploit – the app, the resources supporting the app or the data
  • 7. so why bother fighting?
  • 8. FIGHTING THE GOOD FIGHT hackers need only one opening, one weakness. developers need to constantly ensure that the security and the integrity of the application is maintained
  • 9. RA.ONE VERSUS G.ONE developers will defend and the hackers will attack the good fight is about making secure apps, keeping them secure in operation and safeguarding user data
  • 10. HACKERS ARE NECESSARY AND NOT EVIL hackers and developers represent duality. Without pesky hackers developers mayn‟t have the incentive to keep making secure applications.
  • 12. SOMETHING TO THINK ABOUT  95% of attacks are against “Web Servers and Web Applications” aka Websites  The top 3 verticals compromised were Financial Services, Hospitality and Retail.  More than 60% of attacks were caused by external agents.  Primary attack vector was SQL Injection and was used to install customized malware.  Injection Attacks are #1 critical flaw in applications Sources Verizon DBIR 2010, Whitehat Sec Statistics, OWASP Top 10 2010
  • 13. WEB APP ARCHITECTURE – 3 TIER USER AGENTS WEB SERVERS User Agent / Client. Browser, BOT, Program Sends Requests like GET, Web Server listens for requests and sends POST, HEAD, PUT, DELETE appropriate responses like 200, 404, 403 •Has the programming logic to understand all types of requests ( PHP/ASP.net) •Talks to the database Database Software System MySQL, MSSQL W EB SECURITY TRAINING © AKASH MA H A J A N 1 7 T H - 1 9 T H MA Y 2 0 1 0 13
  • 14. WEB APP ARCHITECTURE DATA VIEW Trusted Web Data Store Code Client Running on server Web Server Un-trusted Input hitting the server Web from the client, Service data stores, web services.
  • 15. WEB APP ARCHITECTURE – DATA VIEW The only piece we can trust is the code running on the server. Any data coming to the server, regardless of where it originated from shouldn‟t be trusted. Data should only be trusted once it has been validated by some piece of trusted code.
  • 16. WEB APP ARCHITECTURE – DATA VIEW Trusted code is the code which we know for sure is the same thing that was developed and the integrity is maintained. Based on the validation we can classify data as tainted/bad or un-tainted/good. Only after that the data which is good data for the application should be processed.
  • 17. WHERE ALL IS THE DATA COMING FROM? GET Requests POST Requests, HTML Form data Cookies stored HTTP Headers File Uploads RSS feeds External data-stores or web services @ MA K A S H | A K A S H M. C O M | T H A T W E B APPLICATION SECURITY GUY
  • 18. DATA FLOWS Four main data flows in any web application  Data from request going to be displayed in the browser  Data from the request going to be stored in the database  Data from the response ( from the database ) going to be displayed in the browser  Data from request going to call a remote method/API or read/write something on the server
  • 19. DATA YOU CAN‟T TRUST  Good data for a login page  Username – foo  Password – bar  Bad data for a login page  Username – foo‟ OR 1=1;--  Password – bar‟ OR 1=1;--  Good data for a comment  This is a nice comment  Bad data for a comment  This is an XSS</textarea><script>alert(document.cookie);</script> @ MA K A S H | A K A S H M. C O M - T H A T W E B APPLICATION SECURITY GUY
  • 20. DATA YOU NEED TO PROTECT  Clear text passwords for a username email@example.com  Password is 123456  Data thief steals the entire database and has reusable account details  http://somebank.cxm/account-details.php?id=1234  Did you check that only user with id 1234 can see this?  What if the attacker stole the session cookie of user with id 1234 @ MA K A S H | A K A S H M. C O M - T H A T W E B APPLICATION SECURITY GUY
  • 21. WHAT IS THE RISK? Data view of the web app shows two places of attack Attacking the web application Attacking the users of the said web application
  • 22. TYPES OF ATTACKS  All these attack the web application hosted and running on the web server  Injection attacks  SQL Injection – attacking the database  Command Injection – attacking the system  File Inclusion attacks  Local File Inclusion  Remote File Inclusion  HTTP Response Splitting – attacking HTTP @ MA K A S H | A K A S H M. C O M | T H A T W E B APPLICATION SECURITY GUY
  • 23. ATTACKING THE WEB APP USER All these attacks are meant to attack the user of the web application through it. Cross Site Scripting or commonly known as XSS Cross Site Request Forgery also called Sea- Surf Broken Authentication and Sessions Management @ MA K A S H | A K A S H M. C O M | T H A T W E B APPLICATION SECURITY GUY
  • 24. WHY SHOULD WE MAKE SECURE WEB APPS Malicious users, automated programs, ignorant users are all trying to break your web application as we speak. Web applications which get hacked, go down or fail while being used bring disrepute to your company, can attract financial damages and can be used to attack other targets on the web.
  • 25. HOW DO WE MAKE SECURE WEB APPS Always do server side validation. Any and every data point that originates from outside your web application is bad unless proved otherwise. GET, POST, COOKIE, FILES all requests are bad. So we need to ensure only trusted good data is processed, is allowed in the database and is rendered by the browser.
  • 26. INTEGRITY OF A WEB APPLICATION As the developer you need to ensure that your web application has integrity. The data that flows through it is known, can be trusted and improper data is dealt with in a known way. You can do with error handlers, exception handling and failing gracefully. If you look at it holistically the entire point of your web app is to shovel data from one point to another and do cool things with it.
  • 27. CROSS SITE SCRIPTING - XSS Injecting HTML/JS into the site.  Non-persistent/Reflected/First Order  Script is taken from the request and displayed in the browser directly  example.com/search?q=<script>alert(„hi‟);</script>  Persistent/Stored/Second Order  First name of a registration form is vuln and the value is stored in the database  Hello <iframe src=http://f1y.in/0.js></iframe>
  • 28. XSS MITIGATION IN ASP.NET 2.0  Constrain input and Encode output  For inputs through server controls use validate controls like  RegularExpressionValidator  RangeValidator  For inputs from query strings, cookies, client side HTML  System.Text.RegularExpressions.Regex class  Encode output for html. Convert < to &lt; “ to &quot;  HttpUtility.HtmlEncode  Response.Write(HttpUtility.HtmlEncode(Request.Form[“foo"]));  Encode output for urls created from user input
  • 29. XSS MITIGATION IN ASP.NET 2.0  HttpUtility.UrlEncode  Response.Write(HttpUtility.UrlEncode(urlString));  Check that request validation is enabled in Machine.config and is not overwritten by the Web.config  <system.web> <pages buffer="true" validateRequest="true" /> </system.web>  You can set it to false for certain pages which might require rich text processing.  Client headers like user agent can be malicious as well.  Thumb rule, if its not your data consider it bad. If you can verify it, consider it trusted good data.  White listing helps in verifying good data more than black listing.  See examples at xssed.com  Try out MS Anti XSS Library http://www.codeplex.com/AntiXSS
  • 30. XSS MITIGATION IN PHP  Sanitize all globals ($_GET, $_POST, $_COOKIE)  Use strip_tags()  Use inpekt library code.google.com/p/inspekt  Escape everything before displaying  htmlentities(), htmlspeciachars()  Client headers like user agent can be malicious as well.  Thumb rule, if its not your data consider it bad. If you can verify it, consider it trusted good data.  White listing helps in verifying good data more than black listing.  See examples at xssed.com
  • 31. SQL INJECTION  Allowing SQL to be injected in the database query.  Most common attack point is the search of any dynamic website and registration forms. These two will be definitely talking to the database.  $sql = "SELECT * FROM table WHERE id = '" . Request.QueryString[„id‟] . "'";  id = ' ; DROP DATABASE pubs –  Excellent examples http://google.com/search?q=site:slideshare.net sql injection
  • 32. SQL INJECTION - MITIGATION  Sanitize input data. Check for lengths & types  Use type safe SQL parameterized queries for stored procedures or dynamic SQL queries  Parameter collection SqlParameterCollection using (SqlConnection connection = new SqlConnection(connectionString)) { DataSet userDataset = new DataSet(); SqlDataAdapter myCommand = new SqlDataAdapter( "LoginStoredProcedure", connection); myCommand.SelectCommand.CommandType = CommandType.StoredProcedure;
  • 33. SQL INJECTION - MITIGATION myCommand.SelectCommand.Parameters.Add("@name", SqlDbType.VarChar, 40); myCommand.SelectCommand.Parameters["@name"].Value = Request.QueryString[„name‟]; myCommand.Fill(userDataset); }  Avoid disclosing database error information  <customErrors mode="remoteOnly" />  <customErrors mode="On" defaultRedirect=“ErrorPage.htm" />  See a kickass example of stored proc used to hack more than hundred thousand websites  http://www.breach.com/resources/breach-security-labs/alerts/mass-sql-injection-attack- evolution  MS Source Code Analyzer to SQL Injection  http://www.microsoft.com/downloads/details.aspx?familyid=58A7C46E-A599-4FCB- 9AB4-A4334146B6BA&displaylang=en
  • 34. SQL INJECTION - MITIGATION  mysql_real_escape_string()  $dbquery = sprintf(“SELECT name FROM user WHERE id=„%s‟”, mysql_real_escape_string(„id‟));  Parameterized queries  $res = $query(“SELECT name FROM user WHERE id=?”, $id);  Standard mysql module in PHP doesn‟t allow for parameterized queries. You need mysqli  Stored Procedures  See a kickass example of stored proc used to hack more than hundred thousand websites  http://www.breach.com/resources/breach-security-labs/alerts/mass-sql-injection- attack-evolutio