Skip to content

Detect redirection command in failed authentication response#1318

Open
rmilecki wants to merge 3 commits into
adrienverge:masterfrom
rmilecki:detect-redirect
Open

Detect redirection command in failed authentication response#1318
rmilecki wants to merge 3 commits into
adrienverge:masterfrom
rmilecki:detect-redirect

Conversation

@rmilecki
Copy link
Copy Markdown

@rmilecki rmilecki commented Nov 11, 2025

In some situations server may command user agent to redirect to a
specific page as a result of a failed authentication attempt.

Examples of such responses:
1. ret=0,redir=/remote/login?&err=sslvpn_login_permission_denied&lang=en
2. ret=0,redir=/remote/login?&err=sslvpn_login_password_expired&lang=en

When using a real web browser it results in JavaScript redirecting user
to the URL from "redir" key.

Those redirection URLs may contain a meaningful error code (see examples
above). Check them and log a relevant error message with "err" parameter
value if present.

@rmilecki
Copy link
Copy Markdown
Author

I've slightly improved commit message. Included one more example with a sslvpn_login_password_expired value.

Do you think it's OK to merge this? I find it harmless but helpful debugging output.

@rmilecki
Copy link
Copy Markdown
Author

I thought of one possible change for this pull request. Maybe we should check for redir only when authentication fails (ret=0). I just proposed a change for checking ret value, see #1322

Authentication replies from gateway include a "ret" value that provides
info about authentication result.

Examples:
ret=0,redir=/remote/login?&err=sslvpn_login_password_expired&lang=en
ret=0,redir=/remote/login?&err=sslvpn_login_permission_denied&lang=en
ret=1,redir=/remote/hostcheck_install?auth_type=1&user=0123456789ABCDEF&&grpname=0123456789ABCDEF012345&portal=0123456789ABCDEF0123456789&rip=1.1.1.1&realm=
ret=6,actionurl=/remote/logincheck,magic=1-12345678,reqid=0,grpid=1,pid=249,is_chal_rsp=1,pass_renew=1,allow_cancel=1,chal_msg=Your password will expire in 3 days. Would you like to change it?

Extract & use that value to determine authentication status.

Signed-off-by: Rafał Miłecki <rafal@milecki.pl>
@rmilecki rmilecki changed the title Detect redirection command in authentication response Detect redirection command in failed authentication response Nov 26, 2025
In some situations server may command user agent to redirect to a
specific page as a result of a failed authentication attempt.

Examples of such responses:
1. ret=0,redir=/remote/login?&err=sslvpn_login_permission_denied&lang=en
2. ret=0,redir=/remote/login?&err=sslvpn_login_password_expired&lang=en

When using a real web browser it results in JavaScript redirecting user
to the URL from "redir" key.

Those redirection URLs may contain a meaningful error code (see examples
above). Check them and log a relevant error message with "err" parameter
value if present.

Signed-off-by: Rafał Miłecki <rafal@milecki.pl>
@DimitriPapadopoulos
Copy link
Copy Markdown
Collaborator

@rmilecki This looks like a duplicate of #1322 we can close, can't we?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants