SlideShare a Scribd company logo
1 of 53
Download to read offline
Secure Wordpress Coding
        Aaron Saray
Why Trust This Guy?
                 ● PHP programmer
                   > than a decade
                 ● Nerd since 8 yrs
                   old
                 ● MKEPUG
                 ● Author

                 ● you paid? :)
Why at WordCamp?
● I use WordPress
  ○ even programmers do, yup

● I like WordPress

● WordPress is everywhere
  ○ I actually care about the
    world... you should too!
What is Security?
● Physical, mental, emotional, resources

● Secure programming?
  ○ protecting the user from...
    ■ themselves
    ■ the bad guys
    ■ glitches
Why you should care?
Yay - it's time for everyone's favorite game show!
Myth: ...
Fact: you should care - you're a nice person.
Otherwise you wouldn't be here...
Myth: No one will attack me
Fact: Yes they will.

● No one cares about my little website

● I'm not doing anything important

● They can have it all, I have nothing they want
That's Wrong!
Examples:
● Testing Credit Cards

● Hosting bad stuff

● Stealing User Accounts (and passwords)

● installing trojans
   ○ google now hates you

● Who cares about Google ads?
   ○ They're only $0.02...
$132,994.97
Myth: PHP is so insecure that...
● Bank vault is insecure with the door open

● Haters be hatin'

● PHP users
   ○ Facebook
   ○ Yahoo
   ○ etc
     ■ if it were so bad, then why?
What Security Concerns in Web
Projects Do We Have?
● HTML begat PHP begat WordPress

 ●   SQL Injection

 ●   XSS

 ●   CSRF




 *NOTE: examples are simple, and not
 necessarily indicative of real code.
SQL Injection
● An attack that injects unknown SQL
  commands
  ○ usually done through a form filed
  ○ can be done in a query string

● Consequence?
  ○ read all data
  ○ write / update / delete
  ○ drop tables!
SQL Injection Example
SQL Injection Example



$sql = "select * from user where email='me@aaronsaray.com' and password='monkey'
SQL Injection Example
 What about password of ... say...
 x' or userid=1; --

$sql = "select * from user where email='me@aaronsaray.
com' and
password='x' or userid=1; --'";
SQL Injection Solution
Filter user input!!
Cross Site Scripting (XSS)
● An attack that allows a third party to add and
  execute client side scripts into a web page
   ○ Client side scripting (such as javascript) is fine (and
     useful)
   ○ but not if the site creator didn't approve it

● Consequence?
   ○ form submission
   ○ steal cookie (login token)
   ○ Sammy!
XSS Example
XSS Example
Is this really that bad?

Yup.
XSS Solution
Filter user input!!
Cross Site Request Forgery (CSRF)
● An attack that sends a request from a
  malicious site masquerading as a legitimate
  request.

● Submission or action originating not on your website

● Consequence?
   ○ forms submitted
   ○ any user action done
      ■ potentially authorized users without knowledge
CSRF Example
CSRF Example
CSRF Solution
Multi pronged:
● Use POST for data changes (RFC 2616)
● Use $_POST, not $_REQUEST
● Use a token
    ○ in Wordpress, they're called "nonce"
CSRF Solution
CSRF Solution
CSRF Solution in Wordpress
... so, who cares?
Wordpress is a web project

●   It's PHP
●   It's HTML
●   It's Javascript
●   It's CSS
●   It takes user input
●   It displays user input
What can I do about it?
Thanks for asking!

● Security Scanning Plugin

● Theme Creation Security

● Practice safe plugin'
If you remember just one thing...
Use these Security Plugins:

● Secure Wordpress
  http://wordpress.org/extend/plugins/secure-wordpress/


● WP Security
  http://wordpress.org/extend/plugins/wp-security-scan/
Secure Themes
●   This isn't just filler
    ○    people focus on plugins usually. *slap*

●   Things to consider:
    ○    when using other themes or child themes
    ○    creating your own theme
Themes that you... borrow
●   Everyone grabs a theme
    ○   be smart about it
    ○   if it's too good to be true...

●   Things to remember:
    ○   update themes when they ask you to
        ■    Remember the TimThumb-amo!
    ○   take a look at them
        ■    cdn.google.com/jquery.js
        ■    myhotbride.ru/funfreemoney.js
Themes that you sorta borrow
●   If you see a cool theme...
    ○   Child theme it!
    ○   Stay up to date with the parent security
and if you're in a rush...
●   Theme Authenticity Checker
    ○   http://builtbackwards.com/projects/tac/
so which security issues exist?
● All of them!
Let's check out some best practices
Use built in functions
● set_theme_mod()
● Settings API
Use built in filters
●   esc_attr()
●   esc_html()
●   esc_textarea()
●   esc_url()
●   esc_js()
●   wp_filter_kses()
Filter example
Security through Obscurity
● Not always that bad...
    ○   automated tools - why give them a freebie?

●   remove versions from your themes
Version examples...
O.P.P.
● Other People's
  Plugins!
General Security
● Security is really shared between plugins
  and themes

●   These can be applied to all of your programming, or other people's
    programming.
    ○ For security's sake - be careful when you're hacking other people's
        plugins.
2 Parts Left:
First, and foremost
●   Clean yo' house
Clean it up
●   Update your Wordpress


●   Delete old things:
    ○   plugins
    ○   themes
    ○   user uploads from that hot babe

●   http://codex.wordpress.org/Hardening_WordPress
#2, Code Securely
●   Use NONCE


●   Don't let AJAX files sit around


●   Watch your SQL
Use $wpdb
● It is a global variable
    ○ yup, I hate it too

● Use these methods instead of creating your
  new wheel

http://codex.wordpress.org/Function_Reference/wpdb_Class
$wpdb example
My Final Advice
It's Open Source Software for a reason
Aaron Saray
                     Open Source Developer
                     Milwaukee, WI
Questions?
                         http://aaronsaray.com

● Questions about        @aaronsaray
  Secure Wordpress
  Coding?
                     Milwaukee PHP Users Group
                     http://mkepug.org
                     @mkepug

More Related Content

What's hot

Copy & Pest - A case-study on the clipboard, blind trust and invisible cross-...
Copy & Pest - A case-study on the clipboard, blind trust and invisible cross-...Copy & Pest - A case-study on the clipboard, blind trust and invisible cross-...
Copy & Pest - A case-study on the clipboard, blind trust and invisible cross-...Mario Heiderich
 
Generic Attack Detection - ph-Neutral 0x7d8
Generic Attack Detection - ph-Neutral 0x7d8Generic Attack Detection - ph-Neutral 0x7d8
Generic Attack Detection - ph-Neutral 0x7d8Mario Heiderich
 
An Abusive Relationship with AngularJS
An Abusive Relationship with AngularJSAn Abusive Relationship with AngularJS
An Abusive Relationship with AngularJSMario Heiderich
 
HTML5 - The Good, the Bad, the Ugly
HTML5 - The Good, the Bad, the UglyHTML5 - The Good, the Bad, the Ugly
HTML5 - The Good, the Bad, the UglyMario Heiderich
 
JavaScript From Hell - CONFidence 2.0 2009
JavaScript From Hell - CONFidence 2.0 2009JavaScript From Hell - CONFidence 2.0 2009
JavaScript From Hell - CONFidence 2.0 2009Mario Heiderich
 
The innerHTML Apocalypse
The innerHTML ApocalypseThe innerHTML Apocalypse
The innerHTML ApocalypseMario Heiderich
 
Locking the Throne Room - How ES5+ might change views on XSS and Client Side ...
Locking the Throne Room - How ES5+ might change views on XSS and Client Side ...Locking the Throne Room - How ES5+ might change views on XSS and Client Side ...
Locking the Throne Room - How ES5+ might change views on XSS and Client Side ...Mario Heiderich
 
DEF CON 23 - Ryan Mitchell - separating bots from humans
DEF CON 23 - Ryan Mitchell - separating bots from humansDEF CON 23 - Ryan Mitchell - separating bots from humans
DEF CON 23 - Ryan Mitchell - separating bots from humansFelipe Prado
 

What's hot (8)

Copy & Pest - A case-study on the clipboard, blind trust and invisible cross-...
Copy & Pest - A case-study on the clipboard, blind trust and invisible cross-...Copy & Pest - A case-study on the clipboard, blind trust and invisible cross-...
Copy & Pest - A case-study on the clipboard, blind trust and invisible cross-...
 
Generic Attack Detection - ph-Neutral 0x7d8
Generic Attack Detection - ph-Neutral 0x7d8Generic Attack Detection - ph-Neutral 0x7d8
Generic Attack Detection - ph-Neutral 0x7d8
 
An Abusive Relationship with AngularJS
An Abusive Relationship with AngularJSAn Abusive Relationship with AngularJS
An Abusive Relationship with AngularJS
 
HTML5 - The Good, the Bad, the Ugly
HTML5 - The Good, the Bad, the UglyHTML5 - The Good, the Bad, the Ugly
HTML5 - The Good, the Bad, the Ugly
 
JavaScript From Hell - CONFidence 2.0 2009
JavaScript From Hell - CONFidence 2.0 2009JavaScript From Hell - CONFidence 2.0 2009
JavaScript From Hell - CONFidence 2.0 2009
 
The innerHTML Apocalypse
The innerHTML ApocalypseThe innerHTML Apocalypse
The innerHTML Apocalypse
 
Locking the Throne Room - How ES5+ might change views on XSS and Client Side ...
Locking the Throne Room - How ES5+ might change views on XSS and Client Side ...Locking the Throne Room - How ES5+ might change views on XSS and Client Side ...
Locking the Throne Room - How ES5+ might change views on XSS and Client Side ...
 
DEF CON 23 - Ryan Mitchell - separating bots from humans
DEF CON 23 - Ryan Mitchell - separating bots from humansDEF CON 23 - Ryan Mitchell - separating bots from humans
DEF CON 23 - Ryan Mitchell - separating bots from humans
 

Viewers also liked

Categories, Tags, Custom Post Types! Oh My!
Categories, Tags, Custom Post Types! Oh My!Categories, Tags, Custom Post Types! Oh My!
Categories, Tags, Custom Post Types! Oh My!sprclldr
 
Outside the WordPress Bubble
Outside the WordPress BubbleOutside the WordPress Bubble
Outside the WordPress BubbleJohn Eckman
 
Website Performance, Engagement, and Leads
Website Performance, Engagement, and LeadsWebsite Performance, Engagement, and Leads
Website Performance, Engagement, and LeadsTrust EMedia
 
A Plugin For That presentation
A Plugin For That presentationA Plugin For That presentation
A Plugin For That presentationmarnafriedman
 
BuddyPress Tips: How We Built chekmrk
BuddyPress Tips: How We Built chekmrkBuddyPress Tips: How We Built chekmrk
BuddyPress Tips: How We Built chekmrkWes Chyrchel
 
Money Making Blogs
Money Making BlogsMoney Making Blogs
Money Making BlogsChris Lema
 
Building Your First Widget
Building Your First WidgetBuilding Your First Widget
Building Your First WidgetChris Wilcoxson
 
CSI: WordPress -- Getting Into the Guts
CSI: WordPress -- Getting Into the GutsCSI: WordPress -- Getting Into the Guts
CSI: WordPress -- Getting Into the GutsDougal Campbell
 
WordPress Security & Backups 101
WordPress Security & Backups 101WordPress Security & Backups 101
WordPress Security & Backups 101Maeve Lander
 
Optimizing WordPress Performance
Optimizing WordPress PerformanceOptimizing WordPress Performance
Optimizing WordPress PerformanceDouglas Yuen
 
Supporting Wordpress
Supporting WordpressSupporting Wordpress
Supporting Wordpressmasonjames
 
WordPress 101 - Foundation Friday at WordCamp Chicago 2014 #WCChi
WordPress 101 - Foundation Friday at WordCamp Chicago 2014 #WCChiWordPress 101 - Foundation Friday at WordCamp Chicago 2014 #WCChi
WordPress 101 - Foundation Friday at WordCamp Chicago 2014 #WCChiShanta Nathwani
 
WorryProof WordPress - Backup Strategies for Your Web Site
WorryProof WordPress - Backup Strategies for Your Web SiteWorryProof WordPress - Backup Strategies for Your Web Site
WorryProof WordPress - Backup Strategies for Your Web SiteNathan Ingram
 
Cómo crear plugins para Wordpress
Cómo crear plugins para WordpressCómo crear plugins para Wordpress
Cómo crear plugins para Wordpressralcocer
 
Stop Creating Data For Sake of Creating Data
Stop Creating Data For Sake of Creating DataStop Creating Data For Sake of Creating Data
Stop Creating Data For Sake of Creating DataGeorge Ortiz
 
Power Up Your Non-Profit Website With WordPress
Power Up Your Non-Profit Website With WordPressPower Up Your Non-Profit Website With WordPress
Power Up Your Non-Profit Website With WordPressRaymund Mitchell
 
Website Security - It Begins With Good Posture
Website Security - It Begins With Good PostureWebsite Security - It Begins With Good Posture
Website Security - It Begins With Good PostureTony Perez
 

Viewers also liked (20)

Categories, Tags, Custom Post Types! Oh My!
Categories, Tags, Custom Post Types! Oh My!Categories, Tags, Custom Post Types! Oh My!
Categories, Tags, Custom Post Types! Oh My!
 
Outside the WordPress Bubble
Outside the WordPress BubbleOutside the WordPress Bubble
Outside the WordPress Bubble
 
The Best SEO Plugin for WordPress
The Best SEO Plugin for WordPressThe Best SEO Plugin for WordPress
The Best SEO Plugin for WordPress
 
Website Performance, Engagement, and Leads
Website Performance, Engagement, and LeadsWebsite Performance, Engagement, and Leads
Website Performance, Engagement, and Leads
 
A Plugin For That presentation
A Plugin For That presentationA Plugin For That presentation
A Plugin For That presentation
 
BuddyPress Tips: How We Built chekmrk
BuddyPress Tips: How We Built chekmrkBuddyPress Tips: How We Built chekmrk
BuddyPress Tips: How We Built chekmrk
 
Money Making Blogs
Money Making BlogsMoney Making Blogs
Money Making Blogs
 
Building Your First Widget
Building Your First WidgetBuilding Your First Widget
Building Your First Widget
 
CSI: WordPress -- Getting Into the Guts
CSI: WordPress -- Getting Into the GutsCSI: WordPress -- Getting Into the Guts
CSI: WordPress -- Getting Into the Guts
 
Wcoc preso
Wcoc presoWcoc preso
Wcoc preso
 
WordPress Security & Backups 101
WordPress Security & Backups 101WordPress Security & Backups 101
WordPress Security & Backups 101
 
Optimizing WordPress Performance
Optimizing WordPress PerformanceOptimizing WordPress Performance
Optimizing WordPress Performance
 
Supporting Wordpress
Supporting WordpressSupporting Wordpress
Supporting Wordpress
 
WordPress 101 - Foundation Friday at WordCamp Chicago 2014 #WCChi
WordPress 101 - Foundation Friday at WordCamp Chicago 2014 #WCChiWordPress 101 - Foundation Friday at WordCamp Chicago 2014 #WCChi
WordPress 101 - Foundation Friday at WordCamp Chicago 2014 #WCChi
 
WorryProof WordPress - Backup Strategies for Your Web Site
WorryProof WordPress - Backup Strategies for Your Web SiteWorryProof WordPress - Backup Strategies for Your Web Site
WorryProof WordPress - Backup Strategies for Your Web Site
 
Cómo crear plugins para Wordpress
Cómo crear plugins para WordpressCómo crear plugins para Wordpress
Cómo crear plugins para Wordpress
 
Stop Creating Data For Sake of Creating Data
Stop Creating Data For Sake of Creating DataStop Creating Data For Sake of Creating Data
Stop Creating Data For Sake of Creating Data
 
Power Up Your Non-Profit Website With WordPress
Power Up Your Non-Profit Website With WordPressPower Up Your Non-Profit Website With WordPress
Power Up Your Non-Profit Website With WordPress
 
WordPress as a CMS
WordPress as a CMSWordPress as a CMS
WordPress as a CMS
 
Website Security - It Begins With Good Posture
Website Security - It Begins With Good PostureWebsite Security - It Begins With Good Posture
Website Security - It Begins With Good Posture
 

Similar to WordCamp Milwaukee 2012 - Aaron Saray - Secure Wordpress Coding

Security .NET.pdf
Security .NET.pdfSecurity .NET.pdf
Security .NET.pdfAbhi Jain
 
Pentester++
Pentester++Pentester++
Pentester++CTruncer
 
Your first 5 PHP design patterns - ThatConference 2012
Your first 5 PHP design patterns - ThatConference 2012Your first 5 PHP design patterns - ThatConference 2012
Your first 5 PHP design patterns - ThatConference 2012Aaron Saray
 
Hacking - Breaking Into It
Hacking - Breaking Into ItHacking - Breaking Into It
Hacking - Breaking Into ItCTruncer
 
ShopekLobek first term work summary
ShopekLobek first term work summaryShopekLobek first term work summary
ShopekLobek first term work summaryAshraf Hamdy
 
Ever Present Persistence - Established Footholds Seen in the Wild
Ever Present Persistence - Established Footholds Seen in the WildEver Present Persistence - Established Footholds Seen in the Wild
Ever Present Persistence - Established Footholds Seen in the WildCTruncer
 
Harnessing the cloud_for_saa_s_hosted_platfor
Harnessing the cloud_for_saa_s_hosted_platforHarnessing the cloud_for_saa_s_hosted_platfor
Harnessing the cloud_for_saa_s_hosted_platforLuke Summerfield
 
Security and why you need to review yours.
Security and why you need to review yours.Security and why you need to review yours.
Security and why you need to review yours.David Busby, CISSP
 
Secrets of Google VRP by: Krzysztof Kotowicz, Google Security Team
Secrets of Google VRP by: Krzysztof Kotowicz, Google Security TeamSecrets of Google VRP by: Krzysztof Kotowicz, Google Security Team
Secrets of Google VRP by: Krzysztof Kotowicz, Google Security TeamOWASP Delhi
 
Developing Applications for Android - Lecture#3
Developing Applications for Android - Lecture#3Developing Applications for Android - Lecture#3
Developing Applications for Android - Lecture#3Usman Chaudhry
 
The Supporting Role of Antivirus Evasion while Persisting
The Supporting Role of Antivirus Evasion while PersistingThe Supporting Role of Antivirus Evasion while Persisting
The Supporting Role of Antivirus Evasion while PersistingCTruncer
 
Android "Fight Club" : In pursuit of APPiness -- null Humla Delhi Chapter
Android "Fight Club" : In pursuit of APPiness -- null Humla Delhi ChapterAndroid "Fight Club" : In pursuit of APPiness -- null Humla Delhi Chapter
Android "Fight Club" : In pursuit of APPiness -- null Humla Delhi ChapterAbhinav Mishra
 
Training Webinar: Top front-end techniques for OutSystems
 Training Webinar: Top front-end techniques for OutSystems Training Webinar: Top front-end techniques for OutSystems
Training Webinar: Top front-end techniques for OutSystemsOutSystems
 
Top front-end techniques for OutSystems
Top front-end techniques for OutSystemsTop front-end techniques for OutSystems
Top front-end techniques for OutSystemsRuben Goncalves
 
Developing Better Software
Developing Better SoftwareDeveloping Better Software
Developing Better SoftwareHean Hong Leong
 
Hacking Vulnerable Websites to Bypass Firewalls
Hacking Vulnerable Websites to Bypass FirewallsHacking Vulnerable Websites to Bypass Firewalls
Hacking Vulnerable Websites to Bypass FirewallsNetsparker
 
Services, tools & practices for a software house
Services, tools & practices for a software houseServices, tools & practices for a software house
Services, tools & practices for a software houseParis Apostolopoulos
 
Best practices for JavaScript RIAs
Best practices for JavaScript RIAsBest practices for JavaScript RIAs
Best practices for JavaScript RIAsCarlos Ble
 
Confessions of an Accidental Security Tester
Confessions of an Accidental Security TesterConfessions of an Accidental Security Tester
Confessions of an Accidental Security TesterAlan Richardson
 

Similar to WordCamp Milwaukee 2012 - Aaron Saray - Secure Wordpress Coding (20)

Security .NET.pdf
Security .NET.pdfSecurity .NET.pdf
Security .NET.pdf
 
Pentester++
Pentester++Pentester++
Pentester++
 
Your first 5 PHP design patterns - ThatConference 2012
Your first 5 PHP design patterns - ThatConference 2012Your first 5 PHP design patterns - ThatConference 2012
Your first 5 PHP design patterns - ThatConference 2012
 
Hacking - Breaking Into It
Hacking - Breaking Into ItHacking - Breaking Into It
Hacking - Breaking Into It
 
ShopekLobek first term work summary
ShopekLobek first term work summaryShopekLobek first term work summary
ShopekLobek first term work summary
 
Wordpress Plugins Scanner
Wordpress Plugins ScannerWordpress Plugins Scanner
Wordpress Plugins Scanner
 
Ever Present Persistence - Established Footholds Seen in the Wild
Ever Present Persistence - Established Footholds Seen in the WildEver Present Persistence - Established Footholds Seen in the Wild
Ever Present Persistence - Established Footholds Seen in the Wild
 
Harnessing the cloud_for_saa_s_hosted_platfor
Harnessing the cloud_for_saa_s_hosted_platforHarnessing the cloud_for_saa_s_hosted_platfor
Harnessing the cloud_for_saa_s_hosted_platfor
 
Security and why you need to review yours.
Security and why you need to review yours.Security and why you need to review yours.
Security and why you need to review yours.
 
Secrets of Google VRP by: Krzysztof Kotowicz, Google Security Team
Secrets of Google VRP by: Krzysztof Kotowicz, Google Security TeamSecrets of Google VRP by: Krzysztof Kotowicz, Google Security Team
Secrets of Google VRP by: Krzysztof Kotowicz, Google Security Team
 
Developing Applications for Android - Lecture#3
Developing Applications for Android - Lecture#3Developing Applications for Android - Lecture#3
Developing Applications for Android - Lecture#3
 
The Supporting Role of Antivirus Evasion while Persisting
The Supporting Role of Antivirus Evasion while PersistingThe Supporting Role of Antivirus Evasion while Persisting
The Supporting Role of Antivirus Evasion while Persisting
 
Android "Fight Club" : In pursuit of APPiness -- null Humla Delhi Chapter
Android "Fight Club" : In pursuit of APPiness -- null Humla Delhi ChapterAndroid "Fight Club" : In pursuit of APPiness -- null Humla Delhi Chapter
Android "Fight Club" : In pursuit of APPiness -- null Humla Delhi Chapter
 
Training Webinar: Top front-end techniques for OutSystems
 Training Webinar: Top front-end techniques for OutSystems Training Webinar: Top front-end techniques for OutSystems
Training Webinar: Top front-end techniques for OutSystems
 
Top front-end techniques for OutSystems
Top front-end techniques for OutSystemsTop front-end techniques for OutSystems
Top front-end techniques for OutSystems
 
Developing Better Software
Developing Better SoftwareDeveloping Better Software
Developing Better Software
 
Hacking Vulnerable Websites to Bypass Firewalls
Hacking Vulnerable Websites to Bypass FirewallsHacking Vulnerable Websites to Bypass Firewalls
Hacking Vulnerable Websites to Bypass Firewalls
 
Services, tools & practices for a software house
Services, tools & practices for a software houseServices, tools & practices for a software house
Services, tools & practices for a software house
 
Best practices for JavaScript RIAs
Best practices for JavaScript RIAsBest practices for JavaScript RIAs
Best practices for JavaScript RIAs
 
Confessions of an Accidental Security Tester
Confessions of an Accidental Security TesterConfessions of an Accidental Security Tester
Confessions of an Accidental Security Tester
 

Recently uploaded

08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking MenDelhi Call girls
 
What Are The Drone Anti-jamming Systems Technology?
What Are The Drone Anti-jamming Systems Technology?What Are The Drone Anti-jamming Systems Technology?
What Are The Drone Anti-jamming Systems Technology?Antenna Manufacturer Coco
 
Understanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdfUnderstanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdfUK Journal
 
CNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of ServiceCNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of Servicegiselly40
 
Scaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationScaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationRadu Cotescu
 
Presentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreterPresentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreternaman860154
 
Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)wesley chun
 
08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking MenDelhi Call girls
 
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking MenDelhi Call girls
 
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptxEIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptxEarley Information Science
 
Histor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slideHistor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slidevu2urc
 
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...Igalia
 
Tech Trends Report 2024 Future Today Institute.pdf
Tech Trends Report 2024 Future Today Institute.pdfTech Trends Report 2024 Future Today Institute.pdf
Tech Trends Report 2024 Future Today Institute.pdfhans926745
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerThousandEyes
 
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...Neo4j
 
Boost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfBoost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfsudhanshuwaghmare1
 
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdfThe Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdfEnterprise Knowledge
 
Exploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone ProcessorsExploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone Processorsdebabhi2
 
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking MenDelhi Call girls
 
Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...Enterprise Knowledge
 

Recently uploaded (20)

08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men
 
What Are The Drone Anti-jamming Systems Technology?
What Are The Drone Anti-jamming Systems Technology?What Are The Drone Anti-jamming Systems Technology?
What Are The Drone Anti-jamming Systems Technology?
 
Understanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdfUnderstanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdf
 
CNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of ServiceCNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of Service
 
Scaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationScaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organization
 
Presentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreterPresentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreter
 
Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)
 
08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men
 
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
 
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptxEIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
 
Histor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slideHistor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slide
 
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
 
Tech Trends Report 2024 Future Today Institute.pdf
Tech Trends Report 2024 Future Today Institute.pdfTech Trends Report 2024 Future Today Institute.pdf
Tech Trends Report 2024 Future Today Institute.pdf
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected Worker
 
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
 
Boost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfBoost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdf
 
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdfThe Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
 
Exploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone ProcessorsExploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone Processors
 
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
 
Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...
 

WordCamp Milwaukee 2012 - Aaron Saray - Secure Wordpress Coding

  • 2. Why Trust This Guy? ● PHP programmer > than a decade ● Nerd since 8 yrs old ● MKEPUG ● Author ● you paid? :)
  • 3. Why at WordCamp? ● I use WordPress ○ even programmers do, yup ● I like WordPress ● WordPress is everywhere ○ I actually care about the world... you should too!
  • 4. What is Security? ● Physical, mental, emotional, resources ● Secure programming? ○ protecting the user from... ■ themselves ■ the bad guys ■ glitches
  • 5. Why you should care? Yay - it's time for everyone's favorite game show!
  • 6. Myth: ... Fact: you should care - you're a nice person. Otherwise you wouldn't be here...
  • 7. Myth: No one will attack me Fact: Yes they will. ● No one cares about my little website ● I'm not doing anything important ● They can have it all, I have nothing they want
  • 9. Examples: ● Testing Credit Cards ● Hosting bad stuff ● Stealing User Accounts (and passwords) ● installing trojans ○ google now hates you ● Who cares about Google ads? ○ They're only $0.02...
  • 11. Myth: PHP is so insecure that... ● Bank vault is insecure with the door open ● Haters be hatin' ● PHP users ○ Facebook ○ Yahoo ○ etc ■ if it were so bad, then why?
  • 12. What Security Concerns in Web Projects Do We Have? ● HTML begat PHP begat WordPress ● SQL Injection ● XSS ● CSRF *NOTE: examples are simple, and not necessarily indicative of real code.
  • 13. SQL Injection ● An attack that injects unknown SQL commands ○ usually done through a form filed ○ can be done in a query string ● Consequence? ○ read all data ○ write / update / delete ○ drop tables!
  • 15. SQL Injection Example $sql = "select * from user where email='me@aaronsaray.com' and password='monkey'
  • 16. SQL Injection Example What about password of ... say... x' or userid=1; -- $sql = "select * from user where email='me@aaronsaray. com' and password='x' or userid=1; --'";
  • 18. Cross Site Scripting (XSS) ● An attack that allows a third party to add and execute client side scripts into a web page ○ Client side scripting (such as javascript) is fine (and useful) ○ but not if the site creator didn't approve it ● Consequence? ○ form submission ○ steal cookie (login token) ○ Sammy!
  • 21. Is this really that bad? Yup.
  • 23. Cross Site Request Forgery (CSRF) ● An attack that sends a request from a malicious site masquerading as a legitimate request. ● Submission or action originating not on your website ● Consequence? ○ forms submitted ○ any user action done ■ potentially authorized users without knowledge
  • 26. CSRF Solution Multi pronged: ● Use POST for data changes (RFC 2616) ● Use $_POST, not $_REQUEST ● Use a token ○ in Wordpress, they're called "nonce"
  • 29. CSRF Solution in Wordpress
  • 30. ... so, who cares? Wordpress is a web project ● It's PHP ● It's HTML ● It's Javascript ● It's CSS ● It takes user input ● It displays user input
  • 31. What can I do about it? Thanks for asking! ● Security Scanning Plugin ● Theme Creation Security ● Practice safe plugin'
  • 32. If you remember just one thing... Use these Security Plugins: ● Secure Wordpress http://wordpress.org/extend/plugins/secure-wordpress/ ● WP Security http://wordpress.org/extend/plugins/wp-security-scan/
  • 33. Secure Themes ● This isn't just filler ○ people focus on plugins usually. *slap* ● Things to consider: ○ when using other themes or child themes ○ creating your own theme
  • 34. Themes that you... borrow ● Everyone grabs a theme ○ be smart about it ○ if it's too good to be true... ● Things to remember: ○ update themes when they ask you to ■ Remember the TimThumb-amo! ○ take a look at them ■ cdn.google.com/jquery.js ■ myhotbride.ru/funfreemoney.js
  • 35. Themes that you sorta borrow ● If you see a cool theme... ○ Child theme it! ○ Stay up to date with the parent security
  • 36. and if you're in a rush... ● Theme Authenticity Checker ○ http://builtbackwards.com/projects/tac/
  • 37. so which security issues exist? ● All of them!
  • 38. Let's check out some best practices
  • 39. Use built in functions ● set_theme_mod() ● Settings API
  • 40. Use built in filters ● esc_attr() ● esc_html() ● esc_textarea() ● esc_url() ● esc_js() ● wp_filter_kses()
  • 42. Security through Obscurity ● Not always that bad... ○ automated tools - why give them a freebie? ● remove versions from your themes
  • 45. General Security ● Security is really shared between plugins and themes ● These can be applied to all of your programming, or other people's programming. ○ For security's sake - be careful when you're hacking other people's plugins.
  • 47. First, and foremost ● Clean yo' house
  • 48. Clean it up ● Update your Wordpress ● Delete old things: ○ plugins ○ themes ○ user uploads from that hot babe ● http://codex.wordpress.org/Hardening_WordPress
  • 49. #2, Code Securely ● Use NONCE ● Don't let AJAX files sit around ● Watch your SQL
  • 50. Use $wpdb ● It is a global variable ○ yup, I hate it too ● Use these methods instead of creating your new wheel http://codex.wordpress.org/Function_Reference/wpdb_Class
  • 52. My Final Advice It's Open Source Software for a reason
  • 53. Aaron Saray Open Source Developer Milwaukee, WI Questions? http://aaronsaray.com ● Questions about @aaronsaray Secure Wordpress Coding? Milwaukee PHP Users Group http://mkepug.org @mkepug