Leading/trailing whitespace in passwords is stripped by NewStrValue(), breaking RADIUS auth
Are you using SoftEther VPN 5.x?
- Yes, I'm using SoftEther VPN 5.x, not 4.x.
Version
4.44 build 9807, also 5.x
Component
VPN Client
Operating system & version
Windows 11
Architecture or Hardware model
No response
Steps to reproduce
- Hub with RADIUS auth + wildcard
*user. - Set an AD password to
" Correct-Horse-Battery"(leading space), verify it is valid viaPrincipalContext.ValidateCredentials(). - Connect with Auth Type "RADIUS or NT Domain Authentication".
Fails. Decrypting the RADIUS User-Password attribute (RFC 2865 §5.2) shows
21 bytes starting 43 6f 72 ... — the leading 0x20 never left the client.
✔️ Expected Behavior
The password is transmitted byte-for-byte as entered, and authentication succeeds, since the credential is valid in the backend directory.
Whether a password is acceptable is the authentication backend's decision, not the transport layer's.
❌ Actual Behavior
Authentication fails. Leading and trailing spaces and tabs are silently stripped before transmission.
Anything else?
Cause:
src/Mayaqua/Pack.c — NewStrValue():
v->Size = StrLen(str) + 1;
v->Str = Malloc(v->Size);
StrCpy(v->Str, v->Size, str);
Trim(v->Str); // <-- unconditionalPackAddStr(p, "plain_password", ...) → NewStrValue() → Trim().
Trim() removes both ' ' and '\t' from each end (src/Mayaqua/Str.c).
Everything else in the chain is byte-exact — the client dialog, the encrypted
config storage, and RadiusEncryptPassword() in src/Cedar/Radius.c all
preserve the value. The loss happens purely at the PACK layer.
NewUniStrValue() has the same issue with UniTrim().
Affects both branches — the code is identical
- SoftEtherVPN_Stable (4.44 build 9807): src/Mayaqua/Pack.c:662
- SoftEtherVPN master (5.x): src/Mayaqua/Pack.c:563
Avoid passwords with leading or trailing whitespace. There is no configuration option to disable the trimming and no escaping mechanism — any escape sequence would be forwarded to RADIUS literally.
Source: SoftEtherVPN/SoftEtherVPN