Skip to content

Commit 673dbdc

Browse files
Yorick KosterYorick Koster
authored andcommitted
Code review feedback from h00die
1 parent fcf1421 commit 673dbdc

File tree

2 files changed

+31
-2
lines changed

2 files changed

+31
-2
lines changed

documentation/modules/exploit/multi/http/mediawiki_syntaxhighlight.md

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,31 @@
1111
5. optionally set `RPORT`, `SSL`, and `VHOST`
1212
6. `exploit`
1313
7. **Verify** a new Meterpreter session is started
14+
15+
## Options
16+
17+
**TARGETURI**
18+
19+
The MediaWiki base path, the URL path on which MediaWiki is exposed. This is normally `/mediawiki`, `/wiki`, or `/w`.
20+
21+
**UPLOADPATH**
22+
23+
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.
24+
25+
**CLEANUP**
26+
27+
Set this to true (the default) to unlink the PHP file create by this exploit module. The cleanup code will only be called when the exploit is successful.
28+
29+
**USERNAME**
30+
31+
In case the wiki is configured as private, a read-only (or better) account is needed to exploit this issue. Provided the username of that account here.
32+
33+
**PASSWORD**
34+
35+
In case the wiki is configured as private, a read-only (or better) account is needed to exploit this issue. Provided the password of that account here.
1436

1537
## Sample Output
38+
### MediaWiki 1.27.1-2 on Ubuntu 16.10
1639

1740
```
1841
msf > use exploit/multi/http/mediawiki_syntaxhighlight

modules/exploits/multi/http/mediawiki_syntaxhighlight.rb

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,12 @@ def initialize(info = {})
1414
This module exploits an option injection vulnerability in the SyntaxHighlight
1515
extension of MediaWiki. It tries to create & execute a PHP file in the document root.
1616
The USERNAME & PASSWORD options are only needed if the Wiki is configured as private.
17+
18+
This vulnerability affects any MediaWiki installation with SyntaxHighlight version 2.0
19+
installed & enabled. This extension ships with the AIO package of MediaWiki version
20+
1.27.x & 1.28.x. This issue was supposed to be fixed in MediaWiki version 1.28.1
21+
and version 1.27.2. It appears that the fix was pushed to the git repository, but
22+
for some reason it was not included in the release packages.
1723
},
1824
'Author' => 'Yorick Koster',
1925
'License' => MSF_LICENSE,
@@ -130,8 +136,8 @@ def exploit
130136
fail_with(Failure::NoTarget, "#{peer}")
131137
end
132138

133-
phpfile = rand_text_alpha_lower(25) + '.php'
134-
cssfile = datastore['UPLOADPATH'] + '/' + phpfile
139+
phpfile = "#{rand_text_alpha_lower(25)}.php"
140+
cssfile = "#{datastore['UPLOADPATH']}/#{phpfile}"
135141
cleanup = "unlink(\"#{phpfile}\");"
136142
if not datastore['CLEANUP']
137143
cleanup = ""

0 commit comments

Comments
 (0)