SABITHSAHEB opened a new pull request, #14090:
URL: https://github.com/apache/trafficserver/pull/14090

   1. `TSRemapDoRemap` in the experimental url_sig plugin checked the 
client-supplied `S=` value against the expected hex HMAC with `strncmp`, which 
returns at the first differing byte. The check runs on every signed request 
before anything else authenticates the client, so response time depends on how 
many leading characters of the expected HMAC were guessed. That is a 
byte-at-a-time oracle for forging a signature on a URL the attacker chooses.
   2. Switched to `CRYPTO_memcmp` over `sig_len * 2` bytes, which is what the 
access_control plugin already uses for its token digest. The supplied signature 
is length-checked first so a short `S=` cannot be read past its end. The old 
`strncmp` limit had prevented that over-read.
   
   Accept/reject behaviour is unchanged: exact match and a longer `S=` with a 
matching prefix are accepted, while short, mismatched or uppercase signatures 
are rejected. I confirmed this with a small harness under ASan that runs the 
old and new expressions on the same inputs. A local microbenchmark of the old 
comparison on a 40-character SHA1 hex string showed that the time grows with 
the position of the first mismatch (about 4.6 ns at position 0 and 13.4 ns at 
position 39). The patched file builds with `-Wall -Wextra -Werror`. I could not 
run the url_sig Uranium test locally because this machine lacks the PCRE2 
dependency needed for a full build.
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to