By MrPsycho04

Hook

Some bugs hide in plain sight. This one was sitting in a JavaScript file, inside an API call that looked completely ordinary — until I started changing the parameters it accepted.

What initially looked like a normal WordPress polling endpoint turned out to expose content that should never have been accessible to unauthenticated visitors.

Summary

I discovered an unauthenticated information disclosure vulnerability in the o2_read API on redacted.com.

The endpoint was designed to retrieve recent posts for visitors. However, it accepted a parameter called queryVars and passed user-controlled values into WordPress's internal WP_Query.

By manipulating queryVars[suppress_filters], I could disable the filter responsible for restricting results to posts from the previous 24 hours.

Combining this with a metadata query targeting trashed posts allowed me to retrieve their content without authentication.

The exposed content included at least one post that had never been published. It was originally a draft before being moved to the trash.

The issue allowed unauthenticated visitors to access content that was never intended to be publicly available.

Background

The affected website uses the WordPress plugin o2, which provides a live-updating, forum-style experience built around WordPress posts.

The plugin periodically polls an AJAX endpoint to retrieve recent activity without requiring a full page reload.

The relevant endpoint was:

/wp-admin/admin-ajax.php?action=o2_read&method=poll

The endpoint accepts parameters that determine which posts are retrieved.

During my investigation, I noticed that some of these parameters influenced the underlying WordPress query without sufficient validation.

This became the starting point of my investigation.

Discovery Process

I started by examining the website's JavaScript files. This is something I regularly do when testing a target because frontend scripts often reveal API endpoints and provide insight into backend functionality.

While reviewing the o2 plugin's JavaScript, I found the o2_read endpoint.

I noticed that it accepted a parameter called queryVars, which appeared to influence the arguments passed to WordPress's internal post query.

That caught my attention.

Why would an unauthenticated polling endpoint allow visitors to control internal query arguments?

I started investigating the parameters it accepted and eventually focused on suppress_filters.

In WordPress, this argument controls whether query filters are applied.

One of those filters was responsible for restricting the endpoint's results to posts from the previous 24 hours.

Because the endpoint accepted this argument from user-controlled input, I discovered that the restriction could be bypassed.

I then investigated the metadata associated with trashed WordPress posts.

By combining the ability to bypass the time restriction with a metadata query targeting trashed content, I confirmed that the endpoint could return content from deleted posts.

The most interesting finding was that at least one exposed post had originally been a draft and had never been published.

This was no longer just a case of retrieving old public content. It was an actual exposure of unpublished information.

Reproduction Steps

No authentication or session cookies were required to demonstrate the vulnerability.

1. Baseline Request

I first sent a request targeting trashed posts without modifying the default filtering behavior.

bash

text
curl -sS 'https://redacted.com/wp-admin/admin-ajax.php?action=o2_read&method=poll&queryVars%5Bposts_per_page%5D=1&queryVars%5Bmeta_query%5D%5B0%5D%5Bkey%5D=_wp_trash_meta_status'

The response was empty because the targeted post was outside the default 24-hour window.

2. Bypassing the Time Restriction

I then modified the request by adding the suppress_filters parameter.

bash

text
curl -sS 'https://redacted.com/wp-admin/admin-ajax.php?action=o2_read&method=poll&queryVars%5Bsuppress_filters%5D=1&queryVars%5Bposts_per_page%5D=1&queryVars%5Bmeta_query%5D%5B0%5D%5Bkey%5D=_wp_trash_meta_status'

This time, the endpoint returned an HTTP 200 response containing the post fragment.

The response included fields such as:

  • contentRaw

  • contentFiltered

The returned content belonged to a trashed post that was outside the intended 24-hour restriction.

3. Confirming Exposure of an Unpublished Draft

I investigated the post's metadata to determine its original publication state.

This confirmed that at least one exposed post had originally been a draft before being moved to the trash.

In other words, the content had never been publicly published but was still accessible through the unauthenticated API.

4. Testing Scope and Limitations

The issue appeared to allow additional query manipulation, including changing pagination and filtering behavior.

However, I deliberately limited my testing to a single record.

I did not enumerate the entire collection, retrieve additional unpublished content, or retain the exposed post's contents.

This was sufficient to demonstrate the security impact without unnecessarily accessing private information.

Impact

An unauthenticated attacker could potentially exploit this vulnerability to access WordPress content that was not intended to be publicly available.

The potential impact included:

  • Exposure of deleted posts: Retrieve content from posts moved to the trash.

  • Exposure of unpublished drafts: Access content that had never been publicly published.

  • Time restriction bypass: Circumvent the intended 24-hour activity window.

  • Query manipulation: Influence the underlying WordPress query through user-controlled parameters.

  • Bulk data exposure: Potentially retrieve larger collections of posts than intended.

The most significant impact was the exposure of unpublished content without authentication.

Depending on what an affected website stores in its drafts, this could expose confidential discussions, internal announcements, unpublished articles, or other sensitive information.

Fix

The underlying o2 plugin had already shipped fixes for this issue, but the version deployed on the affected website did not include those protections.

The relevant fixes included:

  • Validating and restricting the query arguments accepted by the read API.

  • Preventing user-controlled values from enabling suppress_filters.

  • Adding a guard to prevent trashed-post content from being returned in fragments.

  • Introducing capability checks to prevent comment data associated with non-public or trashed posts from being exposed.

After the fix was applied, repeating the same test no longer returned readable post content.

Instead, the endpoint returned only basic metadata without exposing the post's title or content.

Lessons Learned

  • Inspect client-side JavaScript: Frontend scripts can reveal API endpoints and provide useful insight into backend functionality.

  • Never trust user-controlled query arguments: Internal implementation parameters should not be exposed without strict validation.

  • Enforce authorization server-side: Content visibility must be protected independently of frontend behavior and query filters.

  • Understand WordPress post states: Trashed content is not necessarily previously published content. Drafts can also be moved to the trash.

  • Use minimal proof of concepts: Limiting testing to one record helped demonstrate the vulnerability without unnecessarily accessing additional private information.

Closing Thoughts

This finding was a good reminder that seemingly harmless API parameters can have serious security implications when they expose internal application functionality.

A single query argument was enough to bypass an intended restriction and expose content that should never have been accessible to unauthenticated visitors.

Sometimes, the most interesting vulnerabilities are hiding in the JavaScript we almost overlook.

For more write-ups, community discussions, and bug bounty resources, check out the Bugmith Community About page for community links and a Discord invitation.