Secure Wordpress Null Bhachav

Null Bangalore Bachaav Session Bangalore, India
1 / 22
Slide 1 of Secure Wordpress Null Bhachav
Slide 2 of Secure Wordpress Null Bhachav
Slide 3 of Secure Wordpress Null Bhachav
Slide 4 of Secure Wordpress Null Bhachav
Slide 5 of Secure Wordpress Null Bhachav
Slide 6 of Secure Wordpress Null Bhachav
Slide 7 of Secure Wordpress Null Bhachav
Slide 8 of Secure Wordpress Null Bhachav
Slide 9 of Secure Wordpress Null Bhachav
Slide 10 of Secure Wordpress Null Bhachav
Slide 11 of Secure Wordpress Null Bhachav
Slide 12 of Secure Wordpress Null Bhachav
Slide 13 of Secure Wordpress Null Bhachav
Slide 14 of Secure Wordpress Null Bhachav
Slide 15 of Secure Wordpress Null Bhachav
Slide 16 of Secure Wordpress Null Bhachav
Slide 17 of Secure Wordpress Null Bhachav
Slide 18 of Secure Wordpress Null Bhachav
Slide 19 of Secure Wordpress Null Bhachav
Slide 20 of Secure Wordpress Null Bhachav
Slide 21 of Secure Wordpress Null Bhachav
Slide 22 of Secure Wordpress Null Bhachav

Abstract

Walks through WordPress internals and comprehensive security hardening, covering attack vectors at the core, plugin, and theme levels along with practical defense strategies.

AI Generated Summary

AI Generated Content Disclaimer

Note: This summary is AI-generated and may contain inaccuracies, errors, or omissions. If you spot any issues, please contact the site owner for corrections. Errors or omissions are unintended.

At the Null Bangalore Bachaav session on November 30, 2013, a Null community initiative, the “Secure Wordpress” workshop walked through WordPress internals, setup procedures, and comprehensive security hardening. The deck explains how WordPress executes a request, how to install it on shared and dedicated hosting, which attack vectors exist at the core, plugin, and theme levels, and how to defend using .htaccess rules and child themes instead of modifying core or parent theme files.

Summary

The session began with understanding the platform. The deck traced the execution flow: index.php defines WP_USE_THEMES and includes wp-blog-header.php, which pulls in wp-config.php for the database and other constants and wp-settings.php, after which lots and lots of includes follow, with plugins loaded from the plugin directory and pluggable functions loaded so they can be overridden by plugins. The request lifecycle continues through path declaration, query parsing and assignment, HTTP headers, request parsing, template redirections, and finally theme rendering across the header, loop, widget or sidebar, and footer. A file and folder correlation slide mapped the pieces: wp-config.php, wp-settings.php, index.php, .htaccess, /wp-admin/, /wp-content/ with its plugins and themes, and /wp-includes/.

Setup came next, split by hosting type. On shared hosting the options are using the hosting control panel or uploading via FTP and running install.php. On VPS, dedicated, or cloud servers the options are uploading via SSH or FTP, or syncing via SVN. Server hardening was acknowledged as out of scope for this WordPress-focused session.

The attack surface section started with core level attacks that are present but unpatched: full path disclosures; enumeration issues covering username, attachment, plugins, and themes; account brute force; and version disclosure from multiple places, plus previously exploited issues including the XMLRPC based SSRF attack and DDoS potential. Other attacks listed plugins and themes running old files, vulnerable code in the core, vulnerable code in plugins and themes, and permission and access issues. The enumeration slides made each concrete: index.php?author=1 redirects to /author/, index.php?attachment=1 redirects to the individual attachment URL, plugins and themes are identified through predictable URLs like wp-content/plugin and themes and predictable files like readme.txt and plugin specific assets, and accounts can be enumerated because WordPress returns different error messages for a wrong username versus a wrong password.

Defense started from a principle: core modifications are not recommended because every upgrade modifies core files, and even theme modification is off limits since a new update will override it. The recommended tools are .htaccess based restrictions and hook or function overrides via custom theme templates. The .htaccess section showed redirections with RewriteCond and RewriteRule, and custom directives including DirectoryIndex, ServerSignature Off, and Header unset Etag. The child theme section walked the right way to modify themes: create a child theme folder whose files are picked first before the parent’s, declare it in style.css with a Template header pointing at the parent (twentytwelve in the example) and import the parent stylesheet with @import, then use functions.php for function overrides with remove_action and add_action calls that swap a parent’s widget initialization for your own.

The closing issues slide rounded out the mitigation list: setting display_error to Off in php.ini against full path disclosures, clickjacking protection, SWF and timthumb related attacks, issues related to the wp-includes folder, comment spam, dangerous HTTP methods like PUT, XMLRPC issues, automated scanners, and the WordPress header code. The session ended by telling attendees that with the functions and control mechanisms now known, hardening WordPress is an open playground to keep working in.

Key Themes

  • Know the flow before defending: index.php through wp-blog-header, wp-config, and wp-settings explains where plugins, pluggable functions, and templates enter the picture.
  • Setup is trivial, hardening is not: shared hosting installs via FTP and install.php, VPS via SSH or SVN, and security configuration is a separate discipline from server hardening.
  • Enumeration by default: username redirects via ?author=1, attachment redirects via ?attachment=1, and predictable plugin and theme URLs leak structure that attackers map before attacking.
  • Brute force enabled by error messages: different responses for invalid usernames versus invalid passwords let attackers enumerate valid accounts.
  • Never touch core or parent themes: upgrades overwrite both, so .htaccess restrictions and child theme overrides are the durable way to customize.
  • Child themes done right: a style.css Template header with @import plus functions.php remove_action and add_action overrides survive updates.
  • A long mitigation tail: path disclosure, clickjacking, SWF and timthumb, comment spam, dangerous HTTP methods, XMLRPC, and automated scanners each need their own setting or header.

Notable Points

  • Execution flow: index.php defines WP_USE_THEMES and includes wp-blog-header.php, which includes wp-config.php (database and constants) and wp-settings.php (plugins and pluggable functions).
  • Request lifecycle order: path declaration, query parsing and assignment, HTTP headers, request parsing, template redirections, then theme rendering (header, loop, widget or sidebar, footer).
  • Shared hosting setup uses the hosting control panel or FTP upload plus install.php; VPS, dedicated, and cloud setup uses SSH or FTP upload, or SVN sync.
  • index.php?author=1 redirects to /author/, exposing usernames; index.php?attachment=1 redirects to the individual attachment URL.
  • Plugin and theme enumeration works through predictable URLs (wp-content/plugin, themes) and predictable files (readme.txt, plugin specific js or css assets).
  • Account brute force and enumeration are possible because different error messages distinguish invalid usernames from invalid passwords.
  • Core level unpatched issues include full path disclosures, enumeration, account brute force, and version disclosure in multiple places; previously exploited issues include the XMLRPC based SSRF attack and DDoS.
  • Defense principle: core modifications and direct theme modifications get overwritten by updates, so implement .htaccess restrictions and hook or function overrides via custom theme templates.
  • .htaccess techniques shown: RewriteCond and RewriteRule redirections, DirectoryIndex, ServerSignature Off, and Header unset Etag.
  • Child theme recipe: a folder whose files load before the parent’s, a style.css with the Template header (twentytwelve in the demo) and @import of the parent stylesheet, and functions.php overrides using remove_action and add_action.
  • Full path disclosures are mitigated by setting display_error to Off in php.ini.
  • The remaining issue list includes clickjacking protection, SWF and timthumb related attacks, wp-includes folder issues, comment spam, dangerous methods like PUT, XMLRPC issues, automated scanners, and WordPress header code.

Notable Quotes

“lots and lots of includes”

“Core Modifications is not recommended as every upgrade modifies core files.”

“Implement Custom HTACCESS based restrictions”

“Possible to Enumerate Accounts due to different Error Messages”

“Predictable URL : wp-content/plugin , themes”

“This should help us in getting started and since you are now aware of various functions and ways to control them its an open playground now.”

Embed This Presentation

See Also