Skip to content

Commit

Permalink
release 2.4.12.2: CVE-2022-23527 prevent open redirect in default setup
Browse files Browse the repository at this point in the history
i.e. when OIDCRedirectURLsAllowed is not configured, see:
GHSA-q6f2-285m-gr53

Signed-off-by: Hans Zandbelt <[email protected]>
  • Loading branch information
zandbelt committed Dec 13, 2022
1 parent 1fc47e8 commit 87119f4
Show file tree
Hide file tree
Showing 6 changed files with 15 additions and 8 deletions.
5 changes: 5 additions & 0 deletions ChangeLog
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
12/13/2022
- CVE-2022-23527: prevent open redirect in default setup when OIDCRedirectURLsAllowed is not configured
see: https://github.com/zmartzone/mod_auth_openidc/security/advisories/GHSA-q6f2-285m-gr53
- release 2.4.12.2

12/08/2022
- simplify redis context code
- bump to 2.4.12.2rc1
Expand Down
2 changes: 1 addition & 1 deletion configure.ac
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
AC_INIT([mod_auth_openidc],[2.4.12.2rc1],[[email protected]])
AC_INIT([mod_auth_openidc],[2.4.12.2],[[email protected]])

AC_SUBST(NAMEVER, AC_PACKAGE_TARNAME()-AC_PACKAGE_VERSION())

Expand Down
12 changes: 6 additions & 6 deletions src/mod_auth_openidc.c
Original file line number Diff line number Diff line change
Expand Up @@ -2537,15 +2537,15 @@ apr_byte_t oidc_validate_redirect_url(request_rec *r, oidc_cfg *c,
oidc_error(r, "%s: %s", *err_str, *err_desc);
return FALSE;
}

if ((strstr(url, "/%09") != NULL) || (strstr(url, "/%2f") != NULL)
|| (strstr(url, "/%68") != NULL) || (strstr(url, "/http:") != NULL)
|| (strstr(url, "/https:") != NULL) || (strstr(url, "/javascript:") != NULL)
if ( (strstr(url, "/%09") != NULL) || (oidc_util_strcasestr(url, "/%2f") != NULL)
|| (strstr(url, "/\t") != NULL)
|| (strstr(url, "/%68") != NULL) || (oidc_util_strcasestr(url, "/http:") != NULL)
|| (oidc_util_strcasestr(url, "/https:") != NULL) || (oidc_util_strcasestr(url, "/javascript:") != NULL)
|| (strstr(url, "/〱") != NULL) || (strstr(url, "/〵") != NULL)
|| (strstr(url, "/ゝ") != NULL) || (strstr(url, "/ー") != NULL)
|| (strstr(url, "/〱") != NULL) || (strstr(url, "/ー") != NULL)
|| (strstr(url, "/<") != NULL) || (strstr(url, "%01javascript:") != NULL)
|| (strstr(url, "/%5c") != NULL)) {
|| (strstr(url, "/<") != NULL) || (oidc_util_strcasestr(url, "%01javascript:") != NULL)
|| (strstr(url, "/%5c") != NULL) || (strstr(url, "/\\") != NULL)) {
*err_str = apr_pstrdup(r->pool, "Invalid URL");
*err_desc = apr_psprintf(r->pool, "URL value \"%s\" contains illegal character(s)", url);
oidc_error(r, "%s: %s", *err_str, *err_desc);
Expand Down
1 change: 1 addition & 0 deletions src/mod_auth_openidc.h
Original file line number Diff line number Diff line change
Expand Up @@ -853,6 +853,7 @@ char *oidc_util_http_query_encoded_url(request_rec *r, const char *url, const ap
char *oidc_util_get_full_path(apr_pool_t *pool, const char *abs_or_rel_filename);
apr_byte_t oidc_enabled(request_rec *r);
char *oidc_util_http_form_encoded_data(request_rec *r, const apr_table_t *params);
char* oidc_util_strcasestr(const char *s1, const char *s2);

/* HTTP header constants */
#define OIDC_HTTP_HDR_COOKIE "Cookie"
Expand Down
2 changes: 1 addition & 1 deletion src/util.c
Original file line number Diff line number Diff line change
Expand Up @@ -434,7 +434,7 @@ char* oidc_util_javascript_escape(apr_pool_t *pool, const char *s) {
return output;
}

static char* oidc_util_strcasestr(const char *s1, const char *s2) {
char* oidc_util_strcasestr(const char *s1, const char *s2) {
const char *s = s1;
const char *p = s2;
do {
Expand Down
1 change: 1 addition & 0 deletions test/open-redirect-payload-list.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
/%09/example.com
/ /example.com
/%2f%2fexample.com
/%2f%2f%2fbing.com%2f%3fwww.omise.co
/%2f%5c%2f%67%6f%6f%67%6c%65%2e%63%6f%6d/
Expand Down

0 comments on commit 87119f4

Please sign in to comment.