Unauthenticated Administrative Access in Semantic MediaWiki smwtask API
The Semantic MediaWiki smwtask API module fails to enforce authorization, enabling unauthenticated remote attackers to perform sensitive information disclosure, queue administrative maintenance jobs, and manipulate stored semantic data.
What's new
- 1. added coverage for Semantic MediaWiki (3.1.0 - 7.0.0) Sep 18, 19:52 via ghsa
Semantic MediaWiki versions 3.0.0 through 7.2.1 contain a critical authorization vulnerability in the smwtask API module. The module implements a needsToken('csrf') check, but because MediaWiki provides a fixed, public CSRF token (+\) to anonymous users, this check fails to prevent unauthenticated access. Consequently, an attacker can invoke administrative tasks that are otherwise restricted to users with the smw-admin right via the Special:SMWAdmin web interface. The vulnerability allows attackers to query internal database statistics, enumerate object IDs, inject arbitrary maintenance jobs (such as fulltext search rebuilds or entity disposal), and force synchronous job execution, leading to both information disclosure and potential data integrity loss.
Attack Chain
- Attacker sends a request to
api.php?action=query&meta=tokens&type=csrfto retrieve the anonymous session CSRF token. - The server responds with the default public token value
+\. - Attacker constructs an HTTP POST request to
api.php?action=smwtaskusing the+\token to satisfy the CSRF check. - Attacker calls
table-statisticsvia thetaskparameter to enumerate internal object-ID spaces and database metrics. - Attacker calls
insert-jobto enqueue administrative tasks, such assmw.entityIdDisposerorsmw.fulltextSearchTableRebuild, targeting specific wiki identifiers. - Attacker calls
run-joblistwith a serialized parameters object to force synchronous execution of the injected maintenance jobs. - The application executes the requested administrative jobs with the privileges of the system backend, resulting in unauthorized data modification or performance degradation.
Impact
Successful exploitation allows unauthenticated actors to bypass access controls intended for administrators. Observed consequences include unauthorized disclosure of database internal structures and statistics, resource exhaustion via forced synchronous job execution, and the modification or deletion of semantic data entities. The severity of the impact scales with the size of the wiki's semantic store and the criticality of the targeted maintenance operations.
Recommendation
Prioritize the immediate remediation of affected Semantic MediaWiki instances by upgrading to version 7.3.0 or later. If an immediate upgrade is not feasible, implement a hotfix in the site's LocalSettings.php to unregister the vulnerable API module:
$wgExtensionFunctions[] = static function () {
unset( $GLOBALS['wgAPIModules']['smwtask'] );
};
Deploy detection rules to monitor for anomalous POST requests to the api.php endpoint containing action=smwtask and verify the identity of the requesting user.
Immediate actions
Upgrade Semantic MediaWiki to 7.3.0 or higher.
Apply the LocalSettings.php patch to unset the smwtask API module if immediate upgrade is not possible.
Threat Hunt
Search web logs for POST requests to /api.php with action=smwtask.
Data: webserver_access_logs
Mitigations
Disable smwtask module via PHP snippet in LocalSettings.php
API authorization bypass
Detection coverage 1
Detect Unauthenticated Access to Semantic MediaWiki smwtask
highDetects HTTP POST requests to the smwtask API module, which lacks proper authorization checks.
Detection queries are available on the platform. Get full rules →