Skip to contentSkip to conversation

OpenVPN Client 2FA problem with Backslash

Openvpn-devel Jakob Curdes 4 participants 8 messages Mar 10, 2022 – Mar 11, 2022

lore
Share & tools
lore
#0 lore raw

Hello all,

I think I have found a bug in the OpenVPN Windows client , can you help me to determine if this is true and how to proceed?

We are trying to implement 2FA for several existing Firebox SSL VPNs (which essentially uses OpenVPN on server and client side). The remote users all use the Windows OpenVPN client. This works perfectly without 2FA, and it works also if you do not need to specify the authentication domain on user logon. But for the migration it is necessary to do that as I cannot convert all users at once - the domain you enter in the username field is then "authpoint" instead of something like "company.private". In the 2FA process, the OpenVPN client then opens a text window where you can enter a TOTP token or a "p" for a push request. The Backslash is no problem when not using 2FA, then the user auth succeeds. So it seems in the part for the extra control message handling handles backslashes incorrect.

/Typed in Username: authpoint\UserN and corresponding password/

Thu Mar 10 10:35:31 2022 VERIFY OK: depth=0, O=WatchGuard_Technologies, OU=Fireware, CN=Fireware SSLVPN Server
Thu Mar 10 10:35:31 2022 Control Channel: TLSv1.2, cipher TLSv1.2 ECDHE-RSA-CHACHA20-POLY1305, peer certificate: 2048 bit RSA, signature: RSA-SHA256 Thu Mar 10 10:35:31 2022 [Fireware SSLVPN Server] Peer Connection Initiated with [AF_INET]1.2.3.4:443
Thu Mar 10 10:35:32 2022 MANAGEMENT: >STATE:1646904932,GET_CONFIG,,,,,,
Thu Mar 10 10:35:32 2022 SENT CONTROL [Fireware SSLVPN Server]: 'PUSH_REQUEST' (status=1)
Thu Mar 10 10:35:32 2022 AUTH: Received control message: AUTH_FAILED,CRV1:R,E:1796:Yoirtuqeprtiqrew4==:*Type "p" to receive a push notification or type your one-time password*

/(Typed in "p")
/
Thu Mar 10 10:35:32 2022 SIGUSR1[soft,auth-failure] received, process restarting
Thu Mar 10 10:35:32 2022 MANAGEMENT: >STATE:1646904932,RECONNECTING,auth-failure,,,,,
Thu Mar 10 10:35:32 2022 Restart pause, 5 second(s)
*Thu Mar 10 10:35:40 2022 Previous command sent to management failed: ERROR: Options warning: Bad backslash ('\') usage in TCP:0: remember that backslashes are treated as shell-escapes and if you need to pass backslash characters as part of a Windows filename, you sho* Thu Mar 10 10:35:40 2022 MANAGEMENT: CMD 'username "Auth" "*authpoint\UserN*"'
Thu Mar 10 10:35:40 2022 MANAGEMENT: CMD 'password [...]'

This sounds like I need to escape the backslash, but if I do this the auth fails completely before the 2FA part comes into the picture.
Other tricks like forward slashes or "@" do not help here as these are not understood by the auth backend in the firebox.
When using the WatchGuard SSL VPN app this all works (and it has OpenVPN inside....) but I would like to stick to the OpenVPN clients as all the users already have it and know how to handle it.

Best regards and thank you for hints,

Jakob Curdes

#1 lore raw

Am 10.03.22 um 15:14 schrieb Jakob Curdes:

Quoted 7 lines

Hello all,

I think I have found a bug in the OpenVPN Windows client , can you help me to determine if this is true and how to proceed?

We are trying to implement 2FA for several existing Firebox SSL VPNs (which essentially uses OpenVPN on server and client side). The remote users all use the Windows OpenVPN client. This works perfectly without 2FA, and it works also if you do not need to specify the authentication domain on user logon. But for the migration it is necessary to do that as I cannot convert all users at once - the domain you enter in the username field is then "authpoint" instead of something like "company.private". In the 2FA process, the OpenVPN client then opens a text window where you can enter a TOTP token or a "p" for a push request. The Backslash is no problem when not using 2FA, then the user auth succeeds. So it seems in the part for the extra control message handling handles backslashes incorrect.

Be aware that there is a also a newer 2FA method based on auth-pending that addresses many of the shortcoming of the old AUTH_FAILED based method.

Quoted 9 lines

/Typed in Username: authpoint\UserN and corresponding password/

Thu Mar 10 10:35:31 2022 VERIFY OK: depth=0, O=WatchGuard_Technologies, OU=Fireware, CN=Fireware SSLVPN Server
Thu Mar 10 10:35:31 2022 Control Channel: TLSv1.2, cipher TLSv1.2 ECDHE-RSA-CHACHA20-POLY1305, peer certificate: 2048 bit RSA, signature: RSA-SHA256 Thu Mar 10 10:35:31 2022 [Fireware SSLVPN Server] Peer Connection Initiated with [AF_INET]1.2.3.4:443
Thu Mar 10 10:35:32 2022 MANAGEMENT: >STATE:1646904932,GET_CONFIG,,,,,,
Thu Mar 10 10:35:32 2022 SENT CONTROL [Fireware SSLVPN Server]: 'PUSH_REQUEST' (status=1)
Thu Mar 10 10:35:32 2022 AUTH: Received control message: AUTH_FAILED,CRV1:R,E:1796:Yoirtuqeprtiqrew4==:*Type "p" to receive a push notification or type your one-time password*

Quoted 3 lines

/(Typed in "p")
/
Thu Mar 10 10:35:32 2022 SIGUSR1[soft,auth-failure] received, process

Where are you typing this in? in the normal cmd.exe terminal that runs OpenVPN? because that looks like the client just gives you the AUTH_FAILED and then proceeds to connect to the next server.

Quoted 8 lines

restarting
Thu Mar 10 10:35:32 2022 MANAGEMENT:

Quoted 1 line

STATE:1646904932,RECONNECTING,auth-failure,,,,,

Thu Mar 10 10:35:32 2022 Restart pause, 5 second(s)
*Thu Mar 10 10:35:40 2022 Previous command sent to management failed: ERROR: Options warning: Bad backslash ('\') usage in TCP:0: remember that backslashes are treated as shell-escapes and if you need to pass backslash characters as part of a Windows filename, you sho* Thu Mar 10 10:35:40 2022 MANAGEMENT: CMD 'username "Auth" "*authpoint\UserN*"'
Thu Mar 10 10:35:40 2022 MANAGEMENT: CMD 'password [...]'

Quoted 5 lines

This sounds like I need to escape the backslash, but if I do this the auth fails completely before the 2FA part comes into the picture.
Other tricks like forward slashes or "@" do not help here as these are not understood by the auth backend in the firebox.
When using the WatchGuard SSL VPN app this all works (and it has OpenVPN inside....) but I would like to stick to the OpenVPN clients as all the users already have it and know how to handle it.

Best regards and thank you for hints,

The new auth-pending method is much easier to implement. With the old method you need to part the AUTH_FAILED message and wait until the client asks again for the user password on the next connection and give the session password/repsonse then.

For the new method, example of implmentating it on Android:

parsing of the info message:

https://github.com/schwabe/ics-openvpn/blob/97546b9f8b51c0dc60d591b96ae835f00f2b6805/main/src/main/java/de/blinkt/openvpn/core/OpenVPNService.java#L1323

and sending the response:

https://github.com/schwabe/ics-openvpn/blob/97546b9f8b51c0dc60d591b96ae835f00f2b6805/main/src/main/java/de/blinkt/openvpn/core/OpenVpnManagementThread.java#L748

#2 lore raw

Hello list, hello Arne,

Am 10.03.2022 um 16:32 schrieb Arne Schwabe:

Quoted 8 lines

Am 10.03.22 um 15:14 schrieb Jakob Curdes:

Quoted 5 lines

Thu Mar 10 10:35:32 2022 AUTH: Received control message: AUTH_FAILED,CRV1:R,E:1796:Yoirtuqeprtiqrew4==:*Type "p" to receive a push notification or type your one-time password*

/(Typed in "p")
/
Thu Mar 10 10:35:32 2022 SIGUSR1[soft,auth-failure] received, process

Where are you typing this in? in the normal cmd.exe terminal that runs OpenVPN? because that looks like the client just gives you the AUTH_FAILED and then proceeds to connect to the next server.

In a "graphical" popup window of the Windows OpenVPN client which appears when the server is configured to do 2FA. The popup window displays the text from the above log message "ype "p" to receive a push notification or type your one-time password". THe first auth-failed seems to be normal, after that the popup is displayed and when all is well the auth succeeds in the second round.

Quoted 12 lines
Quoted 12 lines

restarting
Thu Mar 10 10:35:32 2022 MANAGEMENT:  >STATE:1646904932,RECONNECTING,auth-failure,,,,,
Thu Mar 10 10:35:32 2022 Restart pause, 5 second(s)
*Thu Mar 10 10:35:40 2022 Previous command sent to management failed: ERROR: Options warning: Bad backslash ('\') usage in TCP:0: remember that backslashes are treated as shell-escapes and if you need to pass backslash characters as part of a Windows filename, you sho* Thu Mar 10 10:35:40 2022 MANAGEMENT: CMD 'username "Auth" "*authpoint\UserN*"'
Thu Mar 10 10:35:40 2022 MANAGEMENT: CMD 'password [...]'

This sounds like I need to escape the backslash, but if I do this the auth fails completely before the 2FA part comes into the picture.
Other tricks like forward slashes or "@" do not help here as these are not understood by the auth backend in the firebox.
When using the WatchGuard SSL VPN app this all works (and it has OpenVPN inside....) but I would like to stick to the OpenVPN clients as all the users already have it and know how to handle it.

Quoted 6 lines
Quoted 1 line

Best regards and thank you for hints,

The new auth-pending method is much easier to implement. With the old method you need to part the AUTH_FAILED message and wait until the client asks again for the user password on the next connection and give the session password/repsonse then.

For the new method, example of implmentating it on Android:

The problem is that I have no control over the method that is used, as I cannot freely configure the embedded OpenVPN server in the Firebox. I think it is just a string handling bug somewhere. On the user list, this morning there was a hint to

"I suspect that in manage.c the "parse_line" call does not differentiate between file paths (for which \\ is needed) and a "domain\username" call." which seems to refer to manage.c in the openvpn repository. Does that make sense? I looked at the code but my C programming knowledge is limited.

JC

#3 lore raw
In reply to Jakob Curdes

Hi,

Quoted 49 lines · Jakob Curdes

Hello all,

I think I have found a bug in the OpenVPN Windows client , can you help me to determine if this is true and how to proceed?

We are trying to implement 2FA for several existing Firebox SSL VPNs (which essentially uses OpenVPN on server and client side). The remote users all use the Windows OpenVPN client. This works perfectly without 2FA, and it works also if you do not need to specify the authentication domain on user logon. But for the migration it is necessary to do that as I cannot convert all users at once - the domain you enter in the username field is then "authpoint" instead of something like "company.private". In the 2FA process, the OpenVPN client then opens a text window where you can enter a TOTP token or a "p" for a push request. The Backslash is no problem when not using 2FA, then the user auth succeeds.
So it seems in the part for the extra control message handling handles backslashes incorrect.

*Typed in Username: authpoint\UserN and corresponding password*

Thu Mar 10 10:35:31 2022 VERIFY OK: depth=0, O=WatchGuard_Technologies, OU=Fireware, CN=Fireware SSLVPN Server
Thu Mar 10 10:35:31 2022 Control Channel: TLSv1.2, cipher TLSv1.2 ECDHE-RSA-CHACHA20-POLY1305, peer certificate: 2048 bit RSA, signature:
RSA-SHA256
Thu Mar 10 10:35:31 2022 [Fireware SSLVPN Server] Peer Connection Initiated with [AF_INET]1.2.3.4:443
Thu Mar 10 10:35:32 2022 MANAGEMENT: >STATE:1646904932,GET_CONFIG,,,,,, Thu Mar 10 10:35:32 2022 SENT CONTROL [Fireware SSLVPN Server]:
'PUSH_REQUEST' (status=1)
Thu Mar 10 10:35:32 2022 AUTH: Received control message:
AUTH_FAILED,CRV1:R,E:1796:Yoirtuqeprtiqrew4==:*Type "p" to receive a push notification or type your one-time password*

*(Typed in "p") *
Thu Mar 10 10:35:32 2022 SIGUSR1[soft,auth-failure] received, process restarting
Thu Mar 10 10:35:32 2022 MANAGEMENT:

Quoted 1 line

STATE:1646904932,RECONNECTING,auth-failure,,,,,

Thu Mar 10 10:35:32 2022 Restart pause, 5 second(s)
*Thu Mar 10 10:35:40 2022 Previous command sent to management failed:
ERROR: Options warning: Bad backslash ('\') usage in TCP:0: remember that backslashes are treated as shell-escapes and if you need to pass backslash characters as part of a Windows filename, you sho*
Thu Mar 10 10:35:40 2022 MANAGEMENT: CMD 'username "Auth" " *authpoint\UserN*"'
Thu Mar 10 10:35:40 2022 MANAGEMENT: CMD 'password [...]'

Quoted 8 lines

This sounds like I need to escape the backslash, but if I do this the auth fails completely before the 2FA part comes into the picture. Other tricks like forward slashes or "@" do not help here as these are not understood by the auth backend in the firebox.
When using the WatchGuard SSL VPN app this all works (and it has OpenVPN inside....) but I would like to stick to the OpenVPN clients as all the users already have it and know how to handle it.

I missed this follow up on the devel list. Please see my reply to openvpn-users. If @ doesnt work there is no easy fix short of patching the GUI.

Selva

#4 lore raw

Hi,

Quoted 3 lines · Selva Nair

I missed this follow up on the devel list. Please see my reply to openvpn-users. If @ doesnt work there is no easy fix short of patching the GUI.

We're planning a 2.5.x release "some time next week" (partly prompted due to the OpenSSL release on tuesday). So now's a good time for GUI fixes :-)

gert

Signature · 6 lines
"If was one thing all people took for granted, was conviction that if you 
 feed honest figures into a computer, honest figures come out. Never doubted 
 it myself till I met a computer with a sense of humor."
                             Robert A. Heinlein, The Moon is a Harsh Mistress

Gert Doering - Munich, Germany                             [email protected]...
#5 lore raw

Hi,

Quoted 10 lines · Gert Doering

Hi,

Quoted 2 lines · Selva Nair

I missed this follow up on the devel list. Please see my reply to openvpn-users. If @ doesnt work there is no easy fix short of patching

the

Quoted 1 line

GUI.

We're planning a 2.5.x release "some time next week" (partly prompted due to the OpenSSL release on

tuesday). So now's a good time for GUI

Quoted 3 lines
Fixes -)

See PR 483 <https://github.com/OpenVPN/openvpn-gui/pull/483>

@Jakob Curdes <[email protected]...> This could be tested using the CI executable here:
https://github.com/OpenVPN/openvpn-gui/suites/5617977743/artifacts/182849130
(for 64 bit Windows). No need to install --- just unzip into a temp folder and double click on the included openvpn-gui.exe.

Selva

#6 lore raw
Quoted 20 lines

Hi,

On Thu, Mar 10, 2022 at 4:23 PM Gert Doering <[email protected]...> wrote:

Hi,

On Thu, Mar 10, 2022 at 12:51:51PM -0500, Selva Nair wrote:
> I missed this follow up on the devel list. Please see my reply to > openvpn-users. If @ doesnt work there is no easy fix short of patching the
> GUI.

We're planning a 2.5.x release "some time next week" (partly prompted due to the OpenSSL release on

tuesday).  So now's a good time for GUI
fixes :-)

Quoted 8 lines

See PR 483 <https://github.com/OpenVPN/openvpn-gui/pull/483>

@Jakob Curdes <mailto:[email protected]...>  This could be tested using
the CI executable here:
https://github.com/OpenVPN/openvpn-gui/suites/5617977743/artifacts/182849130
(for 64 bit Windows). No need to install --- just unzip into a temp folder and double click on the included openvpn-gui.exe.

Selva

Hello Selva, hello all,

I have tested the executable in the circumstances described earlier. I confirm the problem described (username/password auth succeeds, but second auth with 2FA data fails as the backslash in the username is not escaped this time) is solved using the binary provided. I also confirmed this in issue #483  .

Thank you all for your quick work. This will help us rolling out 2FA to a bunch of users!

Regards, Jakob

#7 lore raw

Hi Jacob,

Quoted 11 lines · Jakob Curdes

Hello Selva, hello all,

I have tested the executable in the circumstances described earlier. I confirm the problem described (username/password auth succeeds, but second auth with 2FA data fails as the backslash in the username is not escaped this time) is solved using the binary provided. I also confirmed this in issue #483 .

Thank you all for your quick work. This will help us rolling out 2FA to a bunch of users!

Thanks for testing.

Selva

Quoted 1 line