SlideShare a Scribd company logo
Secure PHP Coding Practices @jeffchannell
Why Should I Care? Loss of reputation (to you as a developer)
Financial Loss
Disclosure of Information
Damage to other sites
Basic Guidelines Trust Nothing Escape for the occasion
Understand different exploitation techniques
Who is this guy? Web developer with Anything Digital Security researcher
Discovered numerous vulnerabilities, primarily in Joomla! extensions
Common Vulnerability Types Information Disclosure
SQL Injection
Code Execution
Cross Site Scripting (XSS)
Cross Site Request Forgery (CSRF)
Information Disclosure Reveals non-public information
Cannot be used by itself to gain access
Useful to an attacker
Generally involves absolute paths to files (Path Disclosure)
Error reporting generally includes paths
MySQL errors
SQL Injection Caused by passing user-supplied input directly into an SQL query
Allows an attacker to alter the query
Does not always divulge information directly (known as “Blind Injection”)
SQL Injection – Example 1 $id  = JRequest::getVar( 'id' ); $query  =  'SELECT id, title FROM #__foobar WHERE id = '  .  $id ; $db  = JFactory::getDbo(); $db ->setQuery( $query ); $results  =  $db ->loadObject();
SQL Injection – Example 1 User input is concatenated with the query
SQL Injection – Example 1 User input is concatenated with the query
A malicious user can exploit this using the following request: index.php?option=com_foobar&id= 0 union select 1,2
SQL Injection – Example 1 User input is concatenated with the query
A malicious user can exploit this using the following request: index.php?option=com_foobar&id= 0 union select 1,2 This causes the query to become: SELECT id, title FROM #__foobar WHERE id =  0 union select 1,2
SQL Injection – Example 1 $id  = JRequest::get Int ( 'id' ); $query  =  'SELECT id, title FROM #__foobar WHERE id = '  .  $id ; $db  = JFactory::getDbo(); $db ->setQuery( $query ); $results  =  $db ->loadObject();
SQL Injection – Example 2 $title  = JRequest::getVar( 'title' ); $query  =  'SELECT id, title FROM #__foobar WHERE title = \''  .  $title  .  '\'' ; $db  = JFactory::getDbo(); $db ->setQuery( $query ); $results  =  $db ->loadObject();

More Related Content

PDF
Http and security
PDF
Security Meetup 22 октября. «Реверс-инжиниринг в Enterprise». Алексей Секрето...
PPTX
PHP Basics
PDF
PHP Object Injection Vulnerability in WordPress: an Analysis
PDF
Asciidoctor New, Noteworthy and Beyond Devoxx-2017
PPT
Zend Framework
PDF
[PL] Jak nie zostać "programistą" PHP?
PDF
Dependency injection in PHP 5.3/5.4
Http and security
Security Meetup 22 октября. «Реверс-инжиниринг в Enterprise». Алексей Секрето...
PHP Basics
PHP Object Injection Vulnerability in WordPress: an Analysis
Asciidoctor New, Noteworthy and Beyond Devoxx-2017
Zend Framework
[PL] Jak nie zostać "programistą" PHP?
Dependency injection in PHP 5.3/5.4

What's hot (20)

PDF
8時間耐久CakePHP2 勉強会
PPT
Php mysql
PDF
A bug bounty tale: Chrome, stylesheets, cookies, and AES
PDF
Machine learning on source code
PDF
Gem christmas calendar
PPT
Jquery presentation
PPTX
Introduction to PHP Lecture 1
PPT
PDF
The Origin of Lithium
PDF
Climbing the Abstract Syntax Tree (php[world] 2019)
PPTX
Creating own language made easy
PPTX
Hardcore PHP
PPT
Php Sq Lite
PPT
Introducation to php for beginners
PPTX
php string-part 2
PPT
Oo Perl
PPT
Perl Xpath Lightning Talk
KEY
PHPSpec BDD for PHP
PDF
Security Bootcamp 2013 - Lap trinh web an toan
PDF
Security Bootcamp 2013 lap trinh web an toan
8時間耐久CakePHP2 勉強会
Php mysql
A bug bounty tale: Chrome, stylesheets, cookies, and AES
Machine learning on source code
Gem christmas calendar
Jquery presentation
Introduction to PHP Lecture 1
The Origin of Lithium
Climbing the Abstract Syntax Tree (php[world] 2019)
Creating own language made easy
Hardcore PHP
Php Sq Lite
Introducation to php for beginners
php string-part 2
Oo Perl
Perl Xpath Lightning Talk
PHPSpec BDD for PHP
Security Bootcamp 2013 - Lap trinh web an toan
Security Bootcamp 2013 lap trinh web an toan
Ad

Similar to Jeff Channell - Secure PHP Coding Practices (20)

PPTX
Secure Programming In Php
PPT
Joomla security nuggets
PDF
PHP Secure Programming
PDF
null Bangalore meet - Php Security
PPT
Php My Sql Security 2007
PPT
Security.ppt
PPT
12-security.ppt - PHP and Arabic Language - Index
PPS
Php Security3895
PPT
Php Security By Mugdha And Anish
PPT
Php & Web Security - PHPXperts 2009
PDF
Making Joomla Insecure - Explaining security by breaking it
PPT
PHPUG Presentation
PPTX
Owasp Top 10 A1: Injection
PPS
Hacking - Web based attacks
ODP
Security In PHP Applications
PPS
PHP Security
PPS
Php security3895
PDF
Web Security 101
PPTX
PHP Database Programming Basics -- Northeast PHP
PDF
Intro to Php Security
Secure Programming In Php
Joomla security nuggets
PHP Secure Programming
null Bangalore meet - Php Security
Php My Sql Security 2007
Security.ppt
12-security.ppt - PHP and Arabic Language - Index
Php Security3895
Php Security By Mugdha And Anish
Php & Web Security - PHPXperts 2009
Making Joomla Insecure - Explaining security by breaking it
PHPUG Presentation
Owasp Top 10 A1: Injection
Hacking - Web based attacks
Security In PHP Applications
PHP Security
Php security3895
Web Security 101
PHP Database Programming Basics -- Northeast PHP
Intro to Php Security
Ad

More from vdrover (17)

PDF
Wordpress security best practices - WordCamp Waukesha 2017
PDF
Joomla, open source and the power of volunteers
PDF
Cracking the inbound marketing code joomla!dagen 2014
PDF
What's coming in Joomla 4 - Joomla Day Budapest 2013
PDF
Adding and modifying LESS in your web site templates
PDF
Joomla SEO Overview featuring sh404SEF
KEY
SEO Optimizing your Content Management System
PDF
Fixing Joomla's SEO problems with sh404SEF
PDF
Rethinking internationalization in Joomla 2.5 and beyond
PDF
There is no spoon 2
PPTX
J upgrade presentation
PPTX
Chad Windnagle - Joomla Tips, Tricks & Must-have Extensions
ODP
Yannick Gaultier - Using sh404SEF to improve search engine ranking of your Jo...
ODP
SEO, Analytics and Security with sh404SEF (JoomlaDay South Africa, 2011, Cape...
PPTX
Joomla! security 101
KEY
Jug joomla 1.6
PPT
Tour of sh404SEF - SEO and security for Joomla
Wordpress security best practices - WordCamp Waukesha 2017
Joomla, open source and the power of volunteers
Cracking the inbound marketing code joomla!dagen 2014
What's coming in Joomla 4 - Joomla Day Budapest 2013
Adding and modifying LESS in your web site templates
Joomla SEO Overview featuring sh404SEF
SEO Optimizing your Content Management System
Fixing Joomla's SEO problems with sh404SEF
Rethinking internationalization in Joomla 2.5 and beyond
There is no spoon 2
J upgrade presentation
Chad Windnagle - Joomla Tips, Tricks & Must-have Extensions
Yannick Gaultier - Using sh404SEF to improve search engine ranking of your Jo...
SEO, Analytics and Security with sh404SEF (JoomlaDay South Africa, 2011, Cape...
Joomla! security 101
Jug joomla 1.6
Tour of sh404SEF - SEO and security for Joomla

Recently uploaded (20)

PDF
Reach Out and Touch Someone: Haptics and Empathic Computing
PDF
Architecting across the Boundaries of two Complex Domains - Healthcare & Tech...
PDF
Mobile App Security Testing_ A Comprehensive Guide.pdf
PDF
Agricultural_Statistics_at_a_Glance_2022_0.pdf
PDF
Assigned Numbers - 2025 - Bluetooth® Document
PDF
Unlocking AI with Model Context Protocol (MCP)
PPTX
TechTalks-8-2019-Service-Management-ITIL-Refresh-ITIL-4-Framework-Supports-Ou...
PPTX
OMC Textile Division Presentation 2021.pptx
PDF
TokAI - TikTok AI Agent : The First AI Application That Analyzes 10,000+ Vira...
PDF
A comparative study of natural language inference in Swahili using monolingua...
PDF
Univ-Connecticut-ChatGPT-Presentaion.pdf
PPTX
A Presentation on Artificial Intelligence
PPTX
1. Introduction to Computer Programming.pptx
PPTX
Digital-Transformation-Roadmap-for-Companies.pptx
PDF
Video forgery: An extensive analysis of inter-and intra-frame manipulation al...
PDF
Spectral efficient network and resource selection model in 5G networks
PDF
Profit Center Accounting in SAP S/4HANA, S4F28 Col11
PDF
Build a system with the filesystem maintained by OSTree @ COSCUP 2025
PDF
Encapsulation_ Review paper, used for researhc scholars
PDF
Machine learning based COVID-19 study performance prediction
Reach Out and Touch Someone: Haptics and Empathic Computing
Architecting across the Boundaries of two Complex Domains - Healthcare & Tech...
Mobile App Security Testing_ A Comprehensive Guide.pdf
Agricultural_Statistics_at_a_Glance_2022_0.pdf
Assigned Numbers - 2025 - Bluetooth® Document
Unlocking AI with Model Context Protocol (MCP)
TechTalks-8-2019-Service-Management-ITIL-Refresh-ITIL-4-Framework-Supports-Ou...
OMC Textile Division Presentation 2021.pptx
TokAI - TikTok AI Agent : The First AI Application That Analyzes 10,000+ Vira...
A comparative study of natural language inference in Swahili using monolingua...
Univ-Connecticut-ChatGPT-Presentaion.pdf
A Presentation on Artificial Intelligence
1. Introduction to Computer Programming.pptx
Digital-Transformation-Roadmap-for-Companies.pptx
Video forgery: An extensive analysis of inter-and intra-frame manipulation al...
Spectral efficient network and resource selection model in 5G networks
Profit Center Accounting in SAP S/4HANA, S4F28 Col11
Build a system with the filesystem maintained by OSTree @ COSCUP 2025
Encapsulation_ Review paper, used for researhc scholars
Machine learning based COVID-19 study performance prediction

Jeff Channell - Secure PHP Coding Practices