Virtual private network servers based on OpenVPN might be vulnerable to remote code execution attacks through Shellshock and other recent flaws that affect the Bash Unix shell.
The OpenVPN attack vector was described in a post on Hacker News Tuesday by Fredrik Strömberg, co-founder of a commercial VPN service called Mullvad.
“OpenVPN has a number of configuration options that can call custom commands during different stages of the tunnel session,” Strömberg said. “Many of these commands are called with environmental variables set, some of which can be controlled by the client.”
Shellshock and several other flaws found in the Bash Unix shell over the past week stem from errors in how the command-line interpreter parses strings passed to it as environment variables. These strings can be crafted to trick Bash into evaluating parts of them as separate commands.
Various applications call Bash in different circumstances and could be used by attackers to pass malicious strings to the shell. This is the case of CGI scripts running on Web servers, the CUPS printing system for Unix-like operating systems, the Secure Shell (SSH) and others.
The security community is still investigating the full scope of the Shellshock flaws and which applications open up remote attack vectors for them. Security researcher Rob Fuller has put together a list of proof-of-concept exploits published so far.
One OpenVPN configuration option that allows for Shellshock exploitation is called auth-user-pass-verify. According to the software’s official documentation this directive provides a plug-in-style interface for extending an OpenVPN server’s authentication capabilities.
The option executes an administrator-defined script via the command-line interpreter in order to validate user names and passwords supplied by connecting clients. This opens up the possibility of clients supplying maliciously crafted user names and passwords that exploit the Shellshock vulnerability when passed to Bash as strings.
Amagicom, the Swedish company that owns Mullvad, informed the OpenVPN developers and some VPN service providers about the auth-user-pass-verify issue last week, but waited before going public to allow them to take the appropriate actions. This Shellshock attack vector is one of the more serious ones, because it does not require authentication.
However, it does appear that the developers of OpenVPN knew about the general security risks associated with auth-user-pass-verify even before the recent Bash flaws were discovered.
“Care must be taken by any user-defined scripts to avoid creating a security vulnerability in the way that these strings are handled,” the official OpenVPN documentation warns for this configuration option. “Never use these strings in such a way that they might be escaped or evaluated by a shell interpreter.”
In other words, the script author needs to make sure that the user name and password strings received from clients do not contain any dangerous characters or sequence of characters before passing them to the shell interpreter. However, instead of relying on the ability of script writers to filter out possible exploits, it’s probably best to deploy the latest Bash patch in this case.