exploit the possibilities
Home Files News &[SERVICES_TAB]About Contact Add New

OpenVPN Monitor 1.1.3 Command Injection

OpenVPN Monitor 1.1.3 Command Injection
Posted Sep 24, 2021
Authored by Sylvain Heiniger, Emanuel Duss

OpenVPN Monitor versions 1.1.3 and below suffer from an injection vulnerability that allows an attacker to inject arbitrary commands into the OpenVPN server management interface socket.

tags | exploit, arbitrary
advisories | CVE-2021-31605
SHA-256 | 4aac8e5a6173c4bf869dd5a55f56e9c252331247d5ba381aa933566cb18beba6

OpenVPN Monitor 1.1.3 Command Injection

Change Mirror Download
#############################################################
#
# COMPASS SECURITY ADVISORY
# https://www.compass-security.com/research/advisories/
#
#############################################################
#
# Product: openvpn-monitor
# Vendor: https://github.com/furlongm/openvpn-monitor
# CSNC ID: CSNC-2021-010
# CVE ID: CVE-2021-31605
# Subject: OpenVPN Management Socket Command Injection
# Severity: High
# Effect: Denial of Service
# Author: Emanuel Duss <emanuel.duss@compass-security.com>
# Sylvain Heiniger <sylvain.heiniger@compass-security.com>
# Date: 2021-09-22
#
#############################################################

Introduction
------------

openvpn-monitor is a simple Python program to generate HTML that displays the
status of an OpenVPN server, including all current connections. It uses the
OpenVPN management console. It typically runs on the same host as the OpenVPN
server. [0][1]

During a security assessment of one of our customers, several security
vulnerabilities were discovered in this software.

This advisory describes an injection vulnerability which allows an attacker to
inject arbitrary commands into the OpenVPN server management interface socket.


Affected
--------

- Vulnerable: openvpn-monitor <= 1.1.3
- Not vulnerable: none

The vulnerability is already fixed in the source code [3], but there is no new
release which contains the fix. Therefore, all currently available releases
contain this vulnerability.


Technical Description
---------------------

The following route is defined which processes user input sent via HTTP POST:

[CUT BY COMPASS]
@app.route('/', method='POST')
def post_slash():
vpn_id = request.forms.get('vpn_id')
ip = request.forms.get('ip')
port = request.forms.get('port')
client_id = request.forms.get('client_id')
return render(vpn_id=vpn_id, ip=ip, port=port, client_id=client_id)
[CUT BY COMPASS]

Depending on the OpenVPN server version, either the `ip` and `port` parameters
or the `client_id` parameter is used in the `self.send_command(command)`
function call as a parameter for a command in the OpenVPN server management
interface socket:

[CUT BY COMPASS]
class OpenvpnMgmtInterface(object):

def __init__(self, cfg, **kwargs):
self.vpns = cfg.vpns

if kwargs.get('vpn_id'):
vpn = self.vpns[kwargs['vpn_id']]
self._socket_connect(vpn)
if vpn['socket_connected']:
release = self.send_command('version\n')
version = semver(self.parse_version(release).split(' ')[1])
if version.major == 2 and \
version.minor >= 4 and \
kwargs.get('client_id'):
command = 'client-kill {0!s}\n'.format(kwargs['client_id'])
else:
command = 'kill {0!s}:{1!s}\n'.format(kwargs['ip'], kwargs['port'])
self.send_command(command)
self._socket_disconnect()
[CUT BY COMPASS]

An attacker can use a newline character (`0x0a`) to inject additional commands
into the socket. This allows an attacker for example to stop the OpenVPN server
by sending a SIGTERM signal via the `signal SIGTERM` management command:

# curl http://openvpn-monitor.example.net -d "vpn_id=UDP&ip=10.5.23.42&port=1194&client_id=5%0asignal%20SIGTERM"

It's also possible to disconnect all clients at once using the `signal SIGHUP`
command or to reconfigure the OpenVPN server or connected clients. See the
OpenVPN documentation [2] for more information about the OpenVPN management
interface socket and all available commands.

This attack can even be performed if the client disconnect feature is disabled,
because of an identified authorization bypass vulnerability (CVE-2021-31606).


Vulnerability Classification
----------------------------

CVSS v3.1 Metrics [3]:

* CVSS Base Score: 9.3
* CVSS Vector: AV:N/AC:L/PR:N/UI:N/S:C/C:N/I:L/A:H


Workaround / Fix
----------------

# openvpn-monitor Vendor

The user input should be sanitized so that it is not possible anymore to break
out of the context and inject own commands into the management socket.

# openvpn-monitor Users

Users of the openvpn-monitor should either apply the patch which is available
on GitHub [2] or use the latest version from the source code repository [1].


Timeline
--------

2021-05-05: Vulnerability discovered
2021-04-20: Requested CVE ID @ MITRE
2021-04-20: Contacted vendor
2021-04-22: Sent details via email to vendor
2021-04-24: Vendor confirmed and already started to work on a fix
2021-09-08: Asked vendor for updates
2021-09-08: Vendor told it's OK to publish the advisory
2021-09-22: Public disclosure


References
----------

[0] http://openvpn-monitor.openbytes.ie/
[1] https://github.com/furlongm/openvpn-monitor
[2] https://openvpn.net/community-resources/management-interface/
[3] https://nvd.nist.gov/vuln-metrics/cvss/v3-calculator?vector=AV:N/AC:L/PR:N/UI:N/S:C/C:N/I:L/A:H&version=3.1


Login or Register to add favorites

File Archive:

May 2024

  • Su
  • Mo
  • Tu
  • We
  • Th
  • Fr
  • Sa
  • 1
    May 1st
    44 Files
  • 2
    May 2nd
    5 Files
  • 3
    May 3rd
    11 Files
  • 4
    May 4th
    0 Files
  • 5
    May 5th
    0 Files
  • 6
    May 6th
    28 Files
  • 7
    May 7th
    3 Files
  • 8
    May 8th
    4 Files
  • 9
    May 9th
    54 Files
  • 10
    May 10th
    12 Files
  • 11
    May 11th
    0 Files
  • 12
    May 12th
    0 Files
  • 13
    May 13th
    17 Files
  • 14
    May 14th
    0 Files
  • 15
    May 15th
    0 Files
  • 16
    May 16th
    0 Files
  • 17
    May 17th
    0 Files
  • 18
    May 18th
    0 Files
  • 19
    May 19th
    0 Files
  • 20
    May 20th
    0 Files
  • 21
    May 21st
    0 Files
  • 22
    May 22nd
    0 Files
  • 23
    May 23rd
    0 Files
  • 24
    May 24th
    0 Files
  • 25
    May 25th
    0 Files
  • 26
    May 26th
    0 Files
  • 27
    May 27th
    0 Files
  • 28
    May 28th
    0 Files
  • 29
    May 29th
    0 Files
  • 30
    May 30th
    0 Files
  • 31
    May 31st
    0 Files

Top Authors In Last 30 Days

File Tags

Systems

packet storm

© 2022 Packet Storm. All rights reserved.

Services
Security Services
Hosting By
Rokasec
close