mod_proxy_balancer: use apr_isspace when scanning Cookie header by arshsmith1 · Pull Request #675 · apache/httpd · GitHub
Skip to content

mod_proxy_balancer: use apr_isspace when scanning Cookie header#675

Open
arshsmith1 wants to merge 1 commit into
apache:trunkfrom
arshsmith1:balancer-cookie-ctype
Open

mod_proxy_balancer: use apr_isspace when scanning Cookie header#675
arshsmith1 wants to merge 1 commit into
apache:trunkfrom
arshsmith1:balancer-cookie-ctype

Conversation

@arshsmith1

Copy link
Copy Markdown
  1. get_cookie_param() scans the client-supplied Cookie request header and passes raw char bytes (start_cookie[-1] and *start_cookie) straight to isspace().
  2. on platforms where char is signed, a cookie byte >= 0x80 reaches isspace() as a negative int, which is outside the unsigned-char / EOF domain the ctype functions are defined for, so the result is undefined.

This is reachable on any balancer with a sticky session (get_cookie_param is called from find_session_route via balancer->s->sticky), so the byte is fully attacker-controlled. Switched both calls to apr_isspace, which indexes through unsigned char and is already what the surrounding proxy/http/server code uses everywhere else.

1. get_cookie_param scans the client-supplied Cookie header and hands raw signed char bytes to isspace().
2. a cookie byte >= 0x80 reaches isspace() as a negative int, outside the unsigned char / EOF domain ctype requires, which is undefined.
Switched both calls to apr_isspace, which indexes via unsigned char like the rest of the proxy and http code.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant