SlideShare a Scribd company logo
Security
Ruins everything on the Internet since 1920*
About me
● Veselin Nikolov
● Automattic
● WP since 1.2
● PHP + MySQL since
3.0
About me
● Veselin Nikolov
● Automattic
● WP since 1.2
● PHP + MySQL since
3.0
● IRC since 1998
Acid Burn
● Controls traffic
lights
● Owns 686
90s
● mIRC, ircops
● MSIE hacks
● Malware
● DoS, botnets
● Proxies, shells,
bots, irc
servers
● Confidentiality
● Integrity
● Availability
Security
● Prevention
● Identification
● Reaction
Security
● Hardware
● Internet
● Servers
● Passwords and Private Keys
● Plugins & Themes
● Our code
● Meatware
It's not about WordPress
● Evil Maid, Trojans
● Antivirus
Hardware
● MITM, routers, Wi-Fi, Poodle, http
● VPN, Proxy, Software Update
Internet
Passwords
Your password is
OK, as long as
it's 6 caracters
and ends with
123.
I recommend
qwe123 :D
● 30%+ of the services use plain text
http://plaintextoffenders.com/about/
● Phishing, Social Engineering, Brute
Force, MITM, keyloggers, human
errors, password databases
Passwords
Somebody somewhere knows many of
your passwords.
Passwords
Password Manager
Unfortunately, many of your clients will have their
accounts compromised.
The Super Admin
The Super Admin
'my secret password' ->
● phpass:
● $P$BXT7cDEtQXkAVarv7mh8WZux1euzwI/
md5:
● a7303f3eee5f3ff1942bfbb1797ea0af
Storing Passwords
● Use strong hashing algorythms.
Phpass is ok, md5 is not.
● Be careful with logs and emails,
they might contain sensitive
information
Storing Passwords
2FA
● https://wordpress.org/plugins/two-fact
● 2FA everything!
Plugins and Themes
● Use reputable sources
● Don't use free versions of paid
plugins
Detection
● VaultPress
● Sucuri
● ?
You need between 0 and 1
Response
● You need proper backups
● Logs
● Stay calm, it happens.
Code Review
Reverse Q & A.
Topics covered:
XSS, Open Redirect, XXE, SQL
Injection, Remote Code Execution
What's wrong with that?
<?php
echo $_GET['hi'];
Cross Site Scripting - XSS
GET ?hi=<script>alert('hi')</script>
<?php
echo $_GET['hi'];
Must be
echo esc_html( $_GET['hi'] );
...let's fix it.
<?php
echo esc_html( printf( 'hi, %s',
$_GET['name'] ) );
Typo :(
<?php
echo esc_html( printf( 'hi, %s',
$_GET['name'] ) );
Late escaping OR sprintf!
What's wrong?
<?php
$youtube_widget = $_REQUEST['src'];
?>
<script src="<?php
echo esc_url( $youtube_widget ); ?>">
</script>
XSS
<?php
$youtube_widget = $_REQUEST['src'];
?>
<script src="<?php
echo esc_url( $youtube_widget ); ?>">
</script>
GET ?src=http://my-evil-site.com/hack.js
Let's add validation...
<?php
$src = $_REQUEST['src'];
if ( ! preg_match( '#https?://youtube.com/#',
$src ) ) {
die( 'Invalid Source!' );
}
?>
<script src="<?php echo esc_url( $src ); ?>">
</script>
Wrong REGEXP.
'#https?://youtube.com/#'
Will match
http://dzver.com/js?http://youtube.com/
Let's fix it.
<?php
$src = $_REQUEST['src'];
if ( ! preg_match( '!^https?://(www.)?
youtube.com/!', $src ) ) {
die( 'Invalid Source!' );
}
?>
<script src="<?php echo esc_url( $src ); ?>">
</script>
'.' is a wilcard
'!^https?://(www.)?youtube.com/!'
Will match
'http://wwwayoutube.com/'
?
<?php
$domain = esc_url( $_GET['domain'] );
$user_host = `host $domain`;
echo esc_html( $user_host );
Remote Code Execution
<?php
$domain = esc_url( $_GET['domain'] );
$user_host = `host $domain`;
echo esc_html( $user_host );
What if
$_GET['domain'] = '| echo "hi!"';
Remote Code Execution
● eval();
● assert();
● ``; //backticks
● system()
● create_function()
● preg_replace( '.../e', $_GET )
?
<?php
// @mdawaffe's example
$xml = simplexml_load_file( $uploaded_file );
?>
<h1><?php printf(
"%s Uploaded!",
esc_html( $xml->title )
); ?></h1>
XML External Entity XXE
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE something
[<!ENTITY awesome SYSTEM
"file:///home/www/public_html/db-config.php"
>]
>
<something>
<title>&awesome;</title>
</something>
XML External Entity XXE
Missing:
libxml_disable_entity_loader(true);
Be careful with XML parsers, careless use
is associated with many vulnerabilities.
?
<?php
$id = $_GET['id'];
if ( intval( $id ) ) {
$result = $wpdb->query(
"DELETE FROM wp_usermeta WHERE user_id = $id"
);
}
SQL Injection
<?php
$id = $_GET['id'];
if ( intval( $id ) ) {
$result = $wpdb->query(
"DELETE FROM wp_usermeta WHERE user_id = $id"
);
}
$id = '5 or 1 = 1'; ->
DELETE FROM wp_usermeta WHERE user_id = 5 or 1 = 1
SQL Injection
<?php
$id = (int) $_GET['id'];
$result = $wpdb->query( $wpdb->prepare(
"DELETE FROM wp_usermeta WHERE user_id = %d",
$id )
);
Or use $wpdb->delete();
?
<?php
$url = $_GET['url'];
if ( preg_match( '!^https?://[^.]+.whatever.com/.+
$!i', $url ) ) {
wp_redirect( $url );
} else {
wp_die( 'hacker :(' );
}
Open Redirect
<?php
// http://3254656436/or.whatever.com/spam
if ( preg_match( '!^https?://[^.]+.whatever.com/.+
$!i', $url ) ) {
wp_redirect( $url );
} else {
wp_die( 'hacker :(' );
}
Thanks
AMA :-)

More Related Content

PDF
Memcache Injection (Hacktrick'15)
PDF
Top X OAuth 2 Hacks
PDF
Practical django secuirty
PPTX
Django Web Application Security
PPTX
Web Uygulama Güvenliği (Akademik Bilişim 2016)
TXT
Ddddddd
PDF
JavaScript Security
PPTX
Java script, security and you - Tri-Cities Javascript Developers Group
Memcache Injection (Hacktrick'15)
Top X OAuth 2 Hacks
Practical django secuirty
Django Web Application Security
Web Uygulama Güvenliği (Akademik Bilişim 2016)
Ddddddd
JavaScript Security
Java script, security and you - Tri-Cities Javascript Developers Group

What's hot (20)

PDF
Integrity protection for third-party JavaScript
PDF
Integrity protection for third-party JavaScript
PPT
PHPUG Presentation
PPTX
Case Study of Django: Web Frameworks that are Secure by Default
PDF
URL to HTML
PPTX
Blacklist3r
DOCX
อาชญากรรมคอมพิวเตอร์และกฎหมายที่เกี่ยวข้อง
PPTX
Javascript Security
PPTX
Mitigating CSRF with two lines of codes
PPTX
ZeroNights 2018 | I <"3 XSS
PPTX
ExpertsLiveEurope The New Era Of Endpoint Security
PPTX
XSS (Cross Site Scripting)
PPTX
Client-side JavaScript Vulnerabilities
PDF
6.2. Hacking most popular websites
PDF
Owning the bad guys
PDF
Bitcoin Mining
PDF
Node.js Authentication and Data Security
PPTX
Javascript Security - Three main methods of defending your MEAN stack
PPTX
Bug Bounty - Play For Money
PPT
Django (Web Applications that are Secure by Default)
Integrity protection for third-party JavaScript
Integrity protection for third-party JavaScript
PHPUG Presentation
Case Study of Django: Web Frameworks that are Secure by Default
URL to HTML
Blacklist3r
อาชญากรรมคอมพิวเตอร์และกฎหมายที่เกี่ยวข้อง
Javascript Security
Mitigating CSRF with two lines of codes
ZeroNights 2018 | I <"3 XSS
ExpertsLiveEurope The New Era Of Endpoint Security
XSS (Cross Site Scripting)
Client-side JavaScript Vulnerabilities
6.2. Hacking most popular websites
Owning the bad guys
Bitcoin Mining
Node.js Authentication and Data Security
Javascript Security - Three main methods of defending your MEAN stack
Bug Bounty - Play For Money
Django (Web Applications that are Secure by Default)
Ad

Viewers also liked (20)

PDF
Guide for de mystifying law of trade mark litigation in India
PDF
IDP Asia Brochure
PPT
Ipr Indian Saga Of Wealth Creation
PDF
Power point training the power of visuals
PDF
India Ip &amp; It Laws News Letter May June 2011
ODP
Cisco ios-cont
PDF
Prefix Forwarding for Publish/Subscribe
PDF
Go &amp; microservices
PDF
Veselin word camp-romania-2014
PPT
Shn Overview Updated 2009 06 P11 20
PPT
Access versus dedicated panel: ESOMAR panel conference Dublin 2008
PDF
La libertà non ha prezzo
PDF
ThesisXSiena: The Content-Based Publish/Subscribe System
PPT
Cultural Asset Mapping in Niagara
PPT
Prezentation \" OS Windiws\"
ODP
Lessons from my work on WordPress.com
PPS
Mukul's Wedding Invitation
PPT
Nimda Worm
PDF
Cypris Chat
PPTX
Introducción al Email Marketing
Guide for de mystifying law of trade mark litigation in India
IDP Asia Brochure
Ipr Indian Saga Of Wealth Creation
Power point training the power of visuals
India Ip &amp; It Laws News Letter May June 2011
Cisco ios-cont
Prefix Forwarding for Publish/Subscribe
Go &amp; microservices
Veselin word camp-romania-2014
Shn Overview Updated 2009 06 P11 20
Access versus dedicated panel: ESOMAR panel conference Dublin 2008
La libertà non ha prezzo
ThesisXSiena: The Content-Based Publish/Subscribe System
Cultural Asset Mapping in Niagara
Prezentation \" OS Windiws\"
Lessons from my work on WordPress.com
Mukul's Wedding Invitation
Nimda Worm
Cypris Chat
Introducción al Email Marketing
Ad

Similar to WordPress Security @ Vienna WordPress + Drupal Meetup (20)

PDF
WordCamp Milwaukee 2012 - Aaron Saray - Secure Wordpress Coding
PDF
EN - BlackHat US 2009 favorite XSS Filters-IDS and how to attack them.pdf
PDF
The Ultimate IDS Smackdown
PDF
How not to suck at Cyber Security
PPTX
Secure Coding
PDF
Web security 101
PDF
PDF
OWASP PHPIDS talk slides
PPTX
Open source security
PPTX
Protect Your WordPress From The Inside Out
PPTX
WordPress Security Tips
PPT
XSS Primer - Noob to Pro in 1 hour
PDF
google dork.pdf
PPTX
Secure coding | XSS Attacks on current Web Applications
PDF
Minor Mistakes In Web Portals
KEY
Application Security for Rich Internet Applicationss (Jfokus 2012)
PDF
Intro to Php Security
PPTX
Open Source Security
PDF
Workshop on Network Security
WordCamp Milwaukee 2012 - Aaron Saray - Secure Wordpress Coding
EN - BlackHat US 2009 favorite XSS Filters-IDS and how to attack them.pdf
The Ultimate IDS Smackdown
How not to suck at Cyber Security
Secure Coding
Web security 101
OWASP PHPIDS talk slides
Open source security
Protect Your WordPress From The Inside Out
WordPress Security Tips
XSS Primer - Noob to Pro in 1 hour
google dork.pdf
Secure coding | XSS Attacks on current Web Applications
Minor Mistakes In Web Portals
Application Security for Rich Internet Applicationss (Jfokus 2012)
Intro to Php Security
Open Source Security
Workshop on Network Security

More from Veselin Nikolov (8)

PPTX
Leadership for Developers, WordCamp Norway
ODP
WordPress Security
ODP
Чести проблеми в сигурността на уеб проектите
ODP
Сигурност при разработката на WordPress разширения
ODP
Разширения
PPT
NoSQL бази от данни - възможности и приложение, дипломна защита
PPT
20 начина да си убиеш блога, без да се усетиш
PPT
Блоговете между двата блогкемпа във Велико Търново
Leadership for Developers, WordCamp Norway
WordPress Security
Чести проблеми в сигурността на уеб проектите
Сигурност при разработката на WordPress разширения
Разширения
NoSQL бази от данни - възможности и приложение, дипломна защита
20 начина да си убиеш блога, без да се усетиш
Блоговете между двата блогкемпа във Велико Търново

Recently uploaded (20)

PDF
Odoo Companies in India – Driving Business Transformation.pdf
PPTX
Operating system designcfffgfgggggggvggggggggg
PPTX
history of c programming in notes for students .pptx
PPTX
Monitoring Stack: Grafana, Loki & Promtail
PDF
Design an Analysis of Algorithms I-SECS-1021-03
PDF
AutoCAD Professional Crack 2025 With License Key
PDF
Website Design Services for Small Businesses.pdf
PDF
Download FL Studio Crack Latest version 2025 ?
PDF
iTop VPN Crack Latest Version Full Key 2025
PDF
Designing Intelligence for the Shop Floor.pdf
PDF
EN-Survey-Report-SAP-LeanIX-EA-Insights-2025.pdf
PDF
iTop VPN Free 5.6.0.5262 Crack latest version 2025
PDF
Design an Analysis of Algorithms II-SECS-1021-03
PPTX
Computer Software and OS of computer science of grade 11.pptx
PDF
Adobe Illustrator 28.6 Crack My Vision of Vector Design
PPTX
Why Generative AI is the Future of Content, Code & Creativity?
PDF
Product Update: Alluxio AI 3.7 Now with Sub-Millisecond Latency
PPTX
Reimagine Home Health with the Power of Agentic AI​
PDF
Salesforce Agentforce AI Implementation.pdf
PDF
CCleaner Pro 6.38.11537 Crack Final Latest Version 2025
Odoo Companies in India – Driving Business Transformation.pdf
Operating system designcfffgfgggggggvggggggggg
history of c programming in notes for students .pptx
Monitoring Stack: Grafana, Loki & Promtail
Design an Analysis of Algorithms I-SECS-1021-03
AutoCAD Professional Crack 2025 With License Key
Website Design Services for Small Businesses.pdf
Download FL Studio Crack Latest version 2025 ?
iTop VPN Crack Latest Version Full Key 2025
Designing Intelligence for the Shop Floor.pdf
EN-Survey-Report-SAP-LeanIX-EA-Insights-2025.pdf
iTop VPN Free 5.6.0.5262 Crack latest version 2025
Design an Analysis of Algorithms II-SECS-1021-03
Computer Software and OS of computer science of grade 11.pptx
Adobe Illustrator 28.6 Crack My Vision of Vector Design
Why Generative AI is the Future of Content, Code & Creativity?
Product Update: Alluxio AI 3.7 Now with Sub-Millisecond Latency
Reimagine Home Health with the Power of Agentic AI​
Salesforce Agentforce AI Implementation.pdf
CCleaner Pro 6.38.11537 Crack Final Latest Version 2025

WordPress Security @ Vienna WordPress + Drupal Meetup