Skip to content
Access control Write-up Beginner

Privilege Escalation - Hello Admin

A WordPress site ran an outdated plugin, WP Support Plus Responsive Ticket System, whose login handler called wp_set_auth_cookie() incorrectly. By submitting a crafted login form with a known username and an email address found through OSINT, an attacker could be logged in as the admin without knowing the password.

Shrey Shah Follow

Published on medium.com

{{media:0}}

Shrey Shah (Jerry), on medium.com

The full write-up lives on its author's site

It belongs to its author, so we link to it rather than copy it. The other two tabs are our own rewrites, checked against it.

Written with AI from the full original report and checked against it passage by passage; anything it could not back up was removed or toned down. The original is the record. 4 min read.

Context

This write-up describes a privilege escalation on a WordPress site that was running a vulnerable plugin. The researcher identified the CMS with wappalyzer, then used wpscan to look for out-of-date plugins, themes and default credentials. The site turned out to be vulnerable to "WP Support Plus Responsive Ticket System", and an exploit for it was available on exploit-db.

The underlying weakness is in how the plugin uses the WordPress function wp_set_auth_cookie(). That function sets the authentication cookies based on a user ID. Its signature, as quoted in the report, is:

Text
wp_set_auth_cookie( int $user_id, bool $remember = false, bool|string $secure =’ ’, string $token = ‘ ‘)

The report explains the parameters as follows:

Parameter Type Required Meaning Default
$user_id int Required User ID none
$remember bool Optional Whether to remember the user; without it the cookie is kept for two days, with it for 14 days or two weeks false
$secure bool or string Optional Whether the auth cookie should only be sent over HTTPS; an empty string means the value of is_ssl() is used ' '
$token string Optional User's session token to use for this cookie ' '

The function also filters the duration of the authentication cookie expiration period, checks whether the connection is secure, secures a login cookie and fires immediately before the authentication cookie is set.

Setup

The only tooling the report names is wappalyzer, wpscan, theHarvester and a simple Python script for serving a file over port 80. No WordPress version, plugin version or target hostname is given. The preconditions visible in the narrative are: a WordPress site, the vulnerable "WP Support Plus Responsive Ticket System" plugin, a default username, and an email address belonging to the site that the exploit needs.

Finding it

  1. The researcher went to the target website and confirmed with wappalyzer that it was using WordPress CMS.

  2. He ran wpscan to check for out-of-date plugins, themes and default credentials, with this command:

    • --url passes the URL.
    • --disable-tls-check disables SSL/TLS certificate verification.
    • --enumerate u enumerates the users.
Image for post
WordPress Scan From the original on medium.com

The report shows the scan output in an image captioned "WordPress Scan".

  1. In this case the site was vulnerable to "WP Support Plus Responsive Ticket System".
Image for post
Vulnerable From the original on medium.com
  1. The scan also revealed a default username.
Image for post
Default Username From the original on medium.com
  1. He searched for the vulnerability on Google and found an exploit on exploit-db.

Exploitation

Step 1: Read the exploit

The exploit code was a simple HTML login form:

HTML
<form method="post" action="http://target.com/wp-admin/admin-ajax.php">	Username: <input type="text" name="username" value="admin">	<input type="hidden" name="email" value="EMAIL">	<input type="hidden" name="action" value="loginGuestFacebook">	<input type="submit" value="Login"></form>Then go to admin panel.

The form posts to wp-admin/admin-ajax.php with three fields: username (pre-filled with admin), a hidden email field, and a hidden action field set to loginGuestFacebook. The report notes that after submitting it you go to the admin panel.

Step 2: Find an email address

Before running the form, the researcher noticed that it needs an email address to work. He enumerated the site with theHarvester and found 4 emails, one of which made the exploit successful. The report does not name the address or say how it was chosen from the four.

Step 3: Serve the exploit

He saved the form as an .html file and ran a simple Python script to transfer the file over port 80.

Image for post
Python HTTP Server From the original on medium.com

Step 4: Run the exploit

He ran the saved .html exploit and got a successful login to admin.

Image for post
Exploit From the original on medium.com

Step 5: Confirm the result

He was logged in as admin without knowing the password.

Image for post
Logged In as Admin From the original on medium.com

Root cause

According to the report, the login was possible because of incorrect usage of wp_set_auth_cookie(). The vulnerable code is shown in the report:

Image for post
Vulnerable Code From the original on medium.com

The report does not show the plugin source beyond this image, so the exact call and the values passed to it are not stated in text. The report attributes the login to incorrect usage of wp_set_auth_cookie() by the plugin.

Impact

An attacker who knows a valid username and an email address associated with the site can obtain an admin session without knowing the password, as demonstrated in the report. The report does not discuss what else could be done with that session, nor whether the technique works when the default username has been changed or when no suitable email can be found. Both of those are preconditions the researcher relied on.

Fix

The direction implied by the root cause is to correct the plugin's use of wp_set_auth_cookie() so that a guest login path cannot set an authentication cookie for an arbitrary user.

Variants to test

  • Run wpscan with user enumeration against other WordPress sites and look for out-of-date plugins with public exploits, as was done here. A positive result is a plugin listed as vulnerable together with an exploit-db entry for it.
  • Check for default usernames left in place. A positive result is a username such as admin returned by enumeration.
  • Look for plugins that expose an unauthenticated AJAX login action, for example an action parameter handled in admin-ajax.php that logs a guest in. A positive result is a login as a privileged user without a password.
  • Use theHarvester against the target's domain to collect email addresses, then test whether any of them satisfies an exploit that requires an email. A positive result is a successful login where the form previously failed.
  • Review any plugin code that calls wp_set_auth_cookie() and check which user ID it passes and under which conditions. A positive result is a path where the user ID is attacker-controlled or fixed to an administrator.

Written with AI from the full original report and checked against it passage by passage; anything it could not back up was removed or toned down. The original is the record. 14 min read.

What happened, in plain words

A security researcher found a way to log in to a WordPress website as its administrator without ever knowing the password. He did not guess the password, and he did not break any encryption. Instead, a plugin installed on the site used a WordPress function incorrectly, and that let the researcher log in as the admin.

A cookie is a small piece of text that a website asks your browser to keep and send back on every later request. It is how a site remembers that you already logged in, a bit like the wristband you get at a festival: you show it once at the entrance, and after that the staff let you back in without checking your ID again. If someone else can get a wristband with your name on it, they get in as you.

The researcher's path was: notice the site runs WordPress, scan it with a tool that lists weak spots, find an out-of-date plugin with a known public exploit, find an email address the exploit needs, serve the exploit page from his own machine, and submit it. The result was an admin session.

Background you need first

What WordPress is

WordPress is a free system for building websites. You install it, and then you add extra pieces called plugins to get features such as contact forms, shops or support ticket systems. The core of WordPress is maintained by a large team, but plugins are written by many different people, and some of them contain mistakes. A mistake in a plugin can undo the security of the whole site, because plugins run with the same power as the rest of the site.

What privilege escalation means

The report defines it simply: privilege escalation means getting privileges to access something that should not be accessible. In everyday terms, imagine a hotel where guests can open their own room but not the manager's office. If a guest finds a trick that opens the manager's office, that is privilege escalation. Here, a visitor (a guest, with no account) ended up with the administrator's session, which is the highest level of access on a WordPress site.

What a session and an authentication cookie are

When you log in to a website, the server checks your username and password once. After that it does not want to ask you again on every page, so it gives your browser a cookie that proves you are logged in. That cookie is called an authentication cookie. The server keeps a matching record on its side, and the cookie is the key that points to it. Anyone who holds a valid authentication cookie is treated as the logged-in user, no password required. That is exactly why the flaw in this report is serious: it lets an outsider obtain that key.

The vulnerable function: wp_set_auth_cookie()

WordPress has a built-in function called wp_set_auth_cookie(). A function is a named block of code that does one job; you give it some inputs (called parameters or arguments) and it performs its task. This particular function's job is to create and send the authentication cookies for a given user. The report quotes its signature, which is the line that lists what inputs it accepts:

Text
wp_set_auth_cookie( int $user_id, bool $remember = false, bool|string $secure =’ ’, string $token = ‘ ‘)

Reading that line from left to right:

  • wp_set_auth_cookie is the name of the function.
  • int $user_id is the first input: the numeric ID of the user the cookie is for. int means a whole number, and $user_id is the name the code uses for it. This one is required.
  • bool $remember = false is the second input: whether to remember the user. bool means true or false. The = false part is a default, meaning if the caller does not supply this input, false is used.
  • bool|string $secure =’ ’ is the third input: whether the cookie should only be sent over HTTPS, the encrypted version of web traffic. It accepts either a true/false value or a piece of text (a string). Its default is an empty string.
  • string $token = ‘ ‘ is the fourth input: the user's session token to use for this cookie. A token is a long random-looking string that identifies one particular session, like a ticket number. Its default is also an empty string.

The report also explains what the function does around the cookie: it filters the duration of the authentication cookie expiration period, checks whether the connection is secure, secures a login cookie, and fires immediately before the authentication cookie is set. In plain words: it decides how long the login lasts, whether the connection is encrypted, and then writes the cookie.

The report then describes the parameters in a table:

Parameter Type Required Meaning Default
$user_id int Required User ID none
$remember bool Optional Whether to remember the user; without it the cookie is kept for two days, with it for 14 days or two weeks false
$secure bool or string Optional Whether the auth cookie should only be sent over HTTPS; an empty string means the value of is_ssl() is used ' '
$token string Optional User's session token to use for this cookie ' '

Two of those entries deserve a word of explanation for a beginner. is_ssl() is a WordPress helper that answers the question "is this connection encrypted?" with true or false. And the $remember behaviour is the same as the "keep me logged in" checkbox you have seen on many websites: tick it and you stay logged in longer, leave it and you are logged out sooner.

On its own, this function is not a vulnerability. It is a normal building block. The problem is how a plugin used it.

The vulnerable code

The report shows the offending code as an image:

Image for post
Vulnerable Code From the original on medium.com

This image is captioned "Vulnerable Code". The report does not reproduce the plugin's source in text, so the exact call and the exact values passed to wp_set_auth_cookie() are not written out. What the report does say is that the plugin used the function incorrectly, and that this incorrect usage is what allowed the login. In other words, the plugin had a path where a guest could trigger the creation of an authentication cookie, and it did not properly establish that the guest was entitled to that cookie.

Finding the vulnerability

The researcher's tools were: wappalyzer, wpscan, theHarvester, and a simple Python script for serving a file over port 80. Port 80 is the standard port for unencrypted web traffic; serving a file on it means running a tiny web server on your own computer so that a browser can fetch a page from it.

No WordPress version, plugin version or target hostname is given in the report. The things that had to be true for the attack to work, as they appear in the story, are: the site runs WordPress, it has the vulnerable "WP Support Plus Responsive Ticket System" plugin, a default username is still in place, and an email address belonging to the site can be found.

Step 1: Confirm the site runs WordPress

He went to the target website and used wappalyzer, a browser extension that inspects a site and reports which technologies it uses, to confirm it was running WordPress. Why this step: the whole plan depends on WordPress-specific tools and a WordPress-specific flaw, so the first question is whether the site is WordPress at all.

Step 2: Scan for weak spots

He ran wpscan, a tool made specifically for checking WordPress sites, to look for out-of-date plugins, out-of-date themes and default credentials. A default credential is a username and password that ships with software and was never changed, like a new door lock still set to the factory code. The command was:

Line by line:

  • wpscan is the program being run.
  • --url https://target.com tells it which site to look at. --url is the option name, and the address after it is the value. target.com is a placeholder for the real site.
  • --disable-tls-check turns off the check of the site's SSL/TLS certificate. A certificate is what proves a site is really itself and lets your browser encrypt traffic to it; this option tells the tool not to stop if the certificate looks wrong.
  • --enumerate u asks the tool to list the site's users. --enumerate is the option, and u is shorthand for users.

Why this step: a scanner does the tedious part for you. Instead of manually inspecting every plugin, you get a list of components that are known to be old or known to be vulnerable, plus the usernames the site exposes.

Image for post
WordPress Scan From the original on medium.com

The image above, captioned "WordPress Scan", shows the scan output. The report says that after the scan completes you get the result of out-of-date and vulnerable things.

Step 3: Note the vulnerable plugin

In this case the site was vulnerable to "WP Support Plus Responsive Ticket System". A support ticket system is a plugin that lets visitors open help requests and staff reply to them; this one had a known security flaw.

Image for post
Vulnerable From the original on medium.com

Step 4: Note the default username

The scan also revealed a default username. This matters because the exploit form, which you will see shortly, is pre-filled with a username.

Image for post
Default Username From the original on medium.com

Step 5: Find a public exploit

He searched for the vulnerability on Google and found an exploit on exploit-db. Exploit-db is a public archive of proof-of-concept attack code for known vulnerabilities. Why this step: once you know a component is vulnerable, the next question is whether someone has already published working code that takes advantage of it. If they have, you do not need to write the attack yourself.

Carrying out the attack

Step 1: Read the exploit

The exploit code was a simple HTML login form:

HTML
<form method="post" action="http://target.com/wp-admin/admin-ajax.php">	Username: <input type="text" name="username" value="admin">	<input type="hidden" name="email" value="EMAIL">	<input type="hidden" name="action" value="loginGuestFacebook">	<input type="submit" value="Login"></form>Then go to admin panel.

This is a web page written in HTML, the language browsers use to describe pages. Line by line:

  • <form method="post" action="http://target.com/wp-admin/admin-ajax.php"> starts a form. method="post" means the browser will send the form's contents as a POST request, which is the kind of request used to submit data rather than just ask for a page. action="http://target.com/wp-admin/admin-ajax.php" is the address the data is sent to. admin-ajax.php is a WordPress file that plugins use to receive requests from the browser; the name AJAX refers to a page talking to the server in the background without reloading.
  • Username: <input type="text" name="username" value="admin"> shows the text "Username:" and a text box. name="username" is the label the server will see for this value, and value="admin" pre-fills the box with the word admin.
  • <input type="hidden" name="email" value="EMAIL"> is a hidden field: the visitor does not see it, but it is still sent. Its label is email and its value is the placeholder EMAIL, which has to be replaced with a real address.
  • <input type="hidden" name="action" value="loginGuestFacebook"> is another hidden field. Its label is action and its value is loginGuestFacebook. This is the crucial one: it tells the plugin which of its features to run, and here it selects a guest login feature.
  • <input type="submit" value="Login"> is the button, labelled "Login".
  • </form> closes the form, and the text Then go to admin panel. is the instruction that follows it.

So the form sends three pieces of information to the plugin: a username, an email address, and the instruction "log this guest in". The report notes that after submitting it you go to the admin panel.

Step 2: Find an email address

Before running the form, he noticed that it needs an email address to work. He enumerated the site with theHarvester and found 4 emails, one of which made the exploit successful. theHarvester is a tool that collects email addresses and similar information that a domain has made public, for example on web pages or in search results. The report does not name the address or say how it was chosen from the four.

Why this step: the exploit's hidden email field is not optional decoration. The exploit form needs an email address, so a real one belonging to the site had to be supplied. Without it, the form would not have produced a login.

Step 3: Serve the exploit page

He saved the form as an .html file and ran a simple Python script to transfer the file over port 80.

Image for post
Python HTTP Server From the original on medium.com

Why this step: the form has to be opened in a browser and submitted to the target site. Serving it from his own machine on port 80 gives him a page he can load locally and control completely, rather than relying on some other website to host it.

Step 4: Run the exploit

He ran the saved .html exploit and got a successful login to admin.

Image for post
Exploit From the original on medium.com

Step 5: Confirm the result

He was logged in as admin without knowing the password.

Image for post
Logged In as Admin From the original on medium.com

Why it worked

According to the report, the login was possible because of incorrect usage of wp_set_auth_cookie(). The report attributes the login to how the plugin calls that function. The report does not describe any check that should have stopped a guest from being authenticated as an administrator, and it does not show the plugin source beyond the image above.

A useful comparison: wp_set_auth_cookie() is like a machine that prints staff badges. Used correctly, it only prints a badge after someone has proved they are staff. The plugin wired the machine so that a visitor could press the button, and the badge that came out was an administrator's.

What an attacker could do with it

The report demonstrates that someone who knows a valid username and an email address associated with the site can obtain an admin session without knowing the password. Those two conditions are things the researcher relied on.

How to fix it

The direction implied by the cause is to correct the plugin's use of wp_set_auth_cookie() so that a guest login path cannot set an authentication cookie for an arbitrary user.

Other places to look for the same pattern

These are the checks the report's approach suggests, written for someone starting out:

  1. Run wpscan with user enumeration against other WordPress sites and look for out-of-date plugins with public exploits. A positive result is a plugin listed as vulnerable together with an exploit-db entry for it.
  2. Check for default usernames left in place. A positive result is a username such as admin returned by enumeration.
  3. Look for plugins that expose an unauthenticated AJAX login action, for example an action parameter handled in admin-ajax.php that logs a guest in. A positive result is a login as a privileged user without a password.
  4. Use theHarvester against the target's domain to collect email addresses, then test whether any of them satisfies an exploit that requires an email. A positive result is a successful login where the form previously failed.
  5. Review any plugin code that calls wp_set_auth_cookie() and check which user ID it passes and under which conditions. A positive result is a path where the user ID is attacker-controlled or fixed to an administrator.

Glossary

  • WordPress: a free system for building websites, extended with plugins and themes.
  • Plugin: an add-on piece of software that adds a feature to WordPress; it runs with the site's own power, so a flaw in it affects the whole site.
  • CMS (Content Management System): software for creating and managing website content; WordPress is one.
  • Privilege escalation: getting access to something you should not be allowed to access, such as a normal visitor reaching administrator powers.
  • Administrator (admin): the highest-level user on a WordPress site, able to change anything.
  • Cookie: a small piece of text a website asks your browser to store and send back with later requests, used to remember who you are.
  • Authentication cookie: the cookie that proves you are logged in; whoever holds a valid one is treated as that user.
  • Session: one continuous logged-in visit, identified on the server side and linked to your cookie.
  • Token: a long random-looking string that identifies one particular session, like a ticket number.
  • Function: a named block of code that performs one job when given inputs.
  • Parameter (argument): an input you give to a function.
  • Signature: the line of code that lists a function's name and the inputs it accepts.
  • wp_set_auth_cookie(): the WordPress function that creates and sends the authentication cookies for a given user ID.
  • is_ssl(): a WordPress helper that reports whether the current connection is encrypted.
  • HTTPS / SSL / TLS: the encrypted version of web traffic, and the certificate system that proves a site's identity.
  • Certificate: the digital document that proves a website is who it claims to be and enables encryption.
  • Default credential: a username or password that ships with software and was never changed.
  • wappalyzer: a browser extension that reports which technologies a website uses.
  • wpscan: a tool that scans WordPress sites for out-of-date components, vulnerable plugins and usernames.
  • User enumeration: listing the usernames that exist on a site.
  • theHarvester: a tool that collects publicly available email addresses and similar information about a domain.
  • exploit-db: a public archive of proof-of-concept attack code for known vulnerabilities.
  • Exploit: code or a technique that takes advantage of a specific vulnerability.
  • Vulnerability: a mistake in software that lets someone do something the software's author did not intend.
  • HTML: the language browsers use to describe the structure of a web page.
  • Form: the part of a web page that collects information and sends it to a server.
  • POST request: a request that sends data to a server, as opposed to simply asking for a page.
  • Hidden field: a form field the visitor cannot see but which is still sent to the server.
  • AJAX / admin-ajax.php: a WordPress file that plugins use to receive background requests from the browser.
  • Port 80: the standard network port for unencrypted web traffic; serving a file on it means running a small web server on your own machine.
  • Python: a programming language; here used for a short script that serves a file over the network.

More by Shrey Shah

View all

6 more disclosed reports, best first.

Similar reports

View all

Same bug class and techniques, clearest first.

Broken access control

The lesson behind this report.

A user can do something their role should not allow: reach an admin function, act on a feature they have not paid for, or skip a permission check. IDOR is the special case where the object belongs to someone else.