SlideShare a Scribd company logo
@brennenbyrne
ANATOMY OF A
WORDPRESS HACK
security is

hard
security is

REALLY
hard
security is

REALLY

REALLY
hard
but probably

NOT
for the reasons
you’re thinking
that’s because security
is all about the

details
3 hacks
that broke wordpress

sqli
xss
clickjacking
(and how they were fixed)
this talk is probably for you
this talk is probably for you
(it’s a really good talk)
you might be wondering

“

if these have already been fixed,
why are we still talking about them?
almost 20% of the web runs on wordpress
almost 20% of the web runs on wordpress
lots of attacks on wordpress sites
almost 20% of the web runs on wordpress
lots of attacks on wordpress sites
they’ll happen again
almost 20% of the web runs on wordpress
lots of attacks on wordpress sites
they’ll happen again
it’s fun and interesting
hello, my name is brennen

@brennenbyrne
I’m a founder of Clef
(getclef.com)
anatomy of a wordpress hack
XSS
cross site scripting
XSS

cross site scripting

when a hacker is able to run
arbitrary code in every user’s browser
let’s hack
how
<{$icontag} class=‘gallery-icon’> ... </{$icontag}>
<{$icontag} class=‘gallery-icon’> ... </{$icontag}>

begin html open tag
<{$icontag} class=‘gallery-icon’> ... </{$icontag}>

}
unsanitized user input
<{$icontag} class=‘gallery-icon’> ... </{$icontag}>

}
end html open tag
<{$icontag} class=‘gallery-icon’> ... </{$icontag}>

begin html close tag
<{$icontag} class=‘gallery-icon’> ... </{$icontag}>

}
unsanitized user input
<{$icontag} class=‘gallery-icon’> ... </{$icontag}>

end html close tag
<{$icontag} class=‘gallery-icon’> ... </{$icontag}>

}

}

unsanitized user input
<{$icontag} class=‘gallery-icon’> ... </{$icontag}>

}

}

unsanitized user input
unsanitized user input
exploit
unsanitized user input
$icontag =
script src=‘hack.js’
$icontag =
script src=‘hack.js’

}
create a script tag
$icontag =
script src=‘hack.js’

}
load an evil script
how bad is this?
full site compromise
one line fix!
$icontag = tag_escape($icontag)
$icontag = tag_escape($icontag)

}
removes potentially
malicious code
Clickjacking
clickjacking
when a hacker tricks you into clicking
something you don’t want to click
let’s hack
how
this is your site
this is your site with an iframe

www.another-site.com
now imagine the green is the article

and the red is “delete post”
now imagine the green is the article

and the red is “delete post”
<iframe src=“admin_url” style=“opacity: 0; z-index: 100></iframe>
<iframe src=“admin_url” style=“opacity: 0; z-index: 100></iframe>

}

}

embedding site in another site
<iframe src=“admin_url” style=“opacity: 0; z-index: 100></iframe>

}
embedding admin page

S
<iframe src=“admin_url” style=“opacity: 0; z-index: 100></iframe>

}
admin page is fully transparent

S
<iframe src=“admin_url” style=“opacity: 0; z-index: 100”></iframe>

}
admin page is above another page
delete post
allow embedding of valuable pages
how bad is this?
full site compromise
one line fix!
@header( 'X-Frame-Options: SAMEORIGIN' );
@header( 'X-Frame-Options: SAMEORIGIN' );

}
add header to requests
for valuable pages
@header( 'X-Frame-Options: SAMEORIGIN' );

}
tell browser to only allow
iframe embed when it’s on
the same domain
SQL injection
SQL injection
when bad people access your
database in bad ways
let’s hack
how
SELECT ... LIMIT $args[4]
SELECT ... LIMIT $args[4]

}
select categories from database
SELECT ... LIMIT $args[4]

}
limit number of categories selected
SELECT ... LIMIT $args[4]

}
unsanitized user input
SELECT ... LIMIT $args[4]

}
unsanitized user input
unsanitized user input
exploit
unsanitized user input
$args[4] =
1 OFFSET 1 UNION ALL SELECT user_login, user_pass FROM wp_users
1 OFFSET 1 UNION ALL SELECT user_login, user_pass FROM wp_users

}
embed a second SQL query
1 OFFSET 1 UNION ALL SELECT user_login, user_pass FROM wp_users

}
limit to 1 category and offset by 1
1 OFFSET 1 UNION ALL SELECT user_login, user_pass FROM wp_users

}
steal usernames and passwords
5 character fix!
(int) $args[4]
(int) $args[4]

}
sanitize user input by
coercing it to an integer
how bad is this?
full site compromise
Anatomy of a WordPress Hack
how does this happen?
security is in the details
security is hard
so what should you do?
1
you cannot know everything
1
you cannot know everything
1
you can always learn more
1
education
2
you will always make mistakes
2
you will always make mistakes
2
you must learn from your mistakes
2
experience
3
you cannot write secure code
3
you cannot write secure code
3
we can write secure code
3
we can write secure code
3
community
closing thoughts
thanks
XSS

Jon Cave
XSS Jon Cave
Clickjacking Andrew Horton
XSS Jon Cave
Clickjacking Andrew Horton
SQLi Alexander Concha
XSS Jon Cave
Clickjacking Andrew Horton
SQLi Alexander Concha
WordPress Security Team
XSS Jon Cave
CSRF Alexander Concha
SQLi Alexander Concha
WordPress Security Team
WordPress Community
what if I find a security issue?
DO

1. verify that it is a real issue
2. email security@wordpress.org

DON’T
1. maliciously exploit other wordpress sites
2. publish details of the vulnerability before it has been fixed
upgrade to

3.7
SELECT * FROM questions

More Related Content

PPTX
Security testing for web developers
PDF
Developer Security for WordPress
PDF
Passwords: the weakest link in WordPress security
PPTX
Passwords the weakest link in word press security
PPT
JTV.Worm
PDF
8 Ways to Hack a WordPress website
PDF
WordCamp Milwaukee 2012 - Aaron Saray - Secure Wordpress Coding
PDF
ResellerClub Ctrl+F5 - WordPress Security session
Security testing for web developers
Developer Security for WordPress
Passwords: the weakest link in WordPress security
Passwords the weakest link in word press security
JTV.Worm
8 Ways to Hack a WordPress website
WordCamp Milwaukee 2012 - Aaron Saray - Secure Wordpress Coding
ResellerClub Ctrl+F5 - WordPress Security session

Similar to Anatomy of a WordPress Hack (20)

PDF
Web Security: What's wrong, and how the bad guys can break your website
PPTX
WordPress Security - WordPress Meetup Copenhagen 2013
PPTX
Neo word press meetup ehermits - how to keep your blog from being hacked 2012
PPT
Secure All The Things!
PDF
WordPress Security Essentials WordCamp Denver 2012
PDF
How not to suck at Cyber Security
PDF
Security Presentation for Boulder WordPress Meetup
PDF
WordPress Security Essentials
PPTX
Open source security
PPTX
Protect Your WordPress From The Inside Out
PDF
Intro to Security (Beginner's Edition) WordCamp St. Louis 2015
PPT
WordPress Security - WordCamp Boston 2010
PPTX
Wordpress Security & Hardening Steps
PPT
Now That's What I Call WordPress Security 2010
PDF
Word camp2011 introwordpresssecurity
PDF
Head Slapping WordPress Security
PPT
WordPress Security
PDF
Types of Security Threats WordPress Websites Face - Part 2
PDF
Rich Web App Security - Keeping your application safe
PPT
Blog World 2010 - How to Keep Your Blog from Being Hacked
Web Security: What's wrong, and how the bad guys can break your website
WordPress Security - WordPress Meetup Copenhagen 2013
Neo word press meetup ehermits - how to keep your blog from being hacked 2012
Secure All The Things!
WordPress Security Essentials WordCamp Denver 2012
How not to suck at Cyber Security
Security Presentation for Boulder WordPress Meetup
WordPress Security Essentials
Open source security
Protect Your WordPress From The Inside Out
Intro to Security (Beginner's Edition) WordCamp St. Louis 2015
WordPress Security - WordCamp Boston 2010
Wordpress Security & Hardening Steps
Now That's What I Call WordPress Security 2010
Word camp2011 introwordpresssecurity
Head Slapping WordPress Security
WordPress Security
Types of Security Threats WordPress Websites Face - Part 2
Rich Web App Security - Keeping your application safe
Blog World 2010 - How to Keep Your Blog from Being Hacked

More from jessepollak (8)

PDF
Building Trust on the Blockchain: The Importance of Mental Models
PDF
Passwords: the weakest link in WordPress security
PDF
WordPress Security Update: How we're building the web's most secure platform ...
PDF
Cryptography 101 (with math)
PDF
Cryptography 101
PDF
Passwords: the weakest link in WordPress security
PDF
Clef security architecture
PDF
Passwords and Botnets and Zombies (oh my!)
Building Trust on the Blockchain: The Importance of Mental Models
Passwords: the weakest link in WordPress security
WordPress Security Update: How we're building the web's most secure platform ...
Cryptography 101 (with math)
Cryptography 101
Passwords: the weakest link in WordPress security
Clef security architecture
Passwords and Botnets and Zombies (oh my!)

Recently uploaded (20)

PPTX
Spectroscopy.pptx food analysis technology
PPTX
KOM of Painting work and Equipment Insulation REV00 update 25-dec.pptx
PDF
Architecting across the Boundaries of two Complex Domains - Healthcare & Tech...
PDF
7 ChatGPT Prompts to Help You Define Your Ideal Customer Profile.pdf
PDF
Approach and Philosophy of On baking technology
PDF
Profit Center Accounting in SAP S/4HANA, S4F28 Col11
PPTX
TLE Review Electricity (Electricity).pptx
PDF
Per capita expenditure prediction using model stacking based on satellite ima...
PDF
Building Integrated photovoltaic BIPV_UPV.pdf
PDF
Empathic Computing: Creating Shared Understanding
PDF
Mushroom cultivation and it's methods.pdf
PDF
Univ-Connecticut-ChatGPT-Presentaion.pdf
PDF
Diabetes mellitus diagnosis method based random forest with bat algorithm
PDF
Mobile App Security Testing_ A Comprehensive Guide.pdf
PDF
Encapsulation theory and applications.pdf
PDF
Accuracy of neural networks in brain wave diagnosis of schizophrenia
PPTX
SOPHOS-XG Firewall Administrator PPT.pptx
PDF
NewMind AI Weekly Chronicles - August'25-Week II
PPTX
TechTalks-8-2019-Service-Management-ITIL-Refresh-ITIL-4-Framework-Supports-Ou...
PDF
Unlocking AI with Model Context Protocol (MCP)
Spectroscopy.pptx food analysis technology
KOM of Painting work and Equipment Insulation REV00 update 25-dec.pptx
Architecting across the Boundaries of two Complex Domains - Healthcare & Tech...
7 ChatGPT Prompts to Help You Define Your Ideal Customer Profile.pdf
Approach and Philosophy of On baking technology
Profit Center Accounting in SAP S/4HANA, S4F28 Col11
TLE Review Electricity (Electricity).pptx
Per capita expenditure prediction using model stacking based on satellite ima...
Building Integrated photovoltaic BIPV_UPV.pdf
Empathic Computing: Creating Shared Understanding
Mushroom cultivation and it's methods.pdf
Univ-Connecticut-ChatGPT-Presentaion.pdf
Diabetes mellitus diagnosis method based random forest with bat algorithm
Mobile App Security Testing_ A Comprehensive Guide.pdf
Encapsulation theory and applications.pdf
Accuracy of neural networks in brain wave diagnosis of schizophrenia
SOPHOS-XG Firewall Administrator PPT.pptx
NewMind AI Weekly Chronicles - August'25-Week II
TechTalks-8-2019-Service-Management-ITIL-Refresh-ITIL-4-Framework-Supports-Ou...
Unlocking AI with Model Context Protocol (MCP)

Anatomy of a WordPress Hack