ESAPI canonicalize malforming url

We have an application that accepts URLs from users. This data needs to be verified, and for this purpose we use ESAPI. However, we are struggling with URLs containing ampersands.

The problem occurs when ESAPI canonicalizes data before validation. & pid = 123 in the url turns into ฯ€d = 123, for example. Since ฯ€ is not white, verification is not performed.

I tried to encode it, but ESAPI is smarter than that and does canonicalization to avoid double encoding and mixed encoding. I'm a little here, and I'm not sure how to proceed.

+2
source share
2 answers

ESAPI. , , , OP , , java.net.URI javax.ws.rs.core.UriBuilder / URL-, , URL-. . , , , .

0

. \fgdf\gghfh\fgh\dff canonicalize :

1: canonicalize (string) โ†’ INTRUSION - (2x) , \fgdf\gghfh\fgh\dff

2: canonicalize (string, false) โ†’ input = fgdfgghfhfghdff ? .

- . :

    value = ESAPI.encoder().encodeForURL(value);
    value = value.replaceAll("", "");
    isSafe = validator.isValidInput("APPNAME", value, "URLSTRING", 255, true, false);

false , .

, .

+1

Source: https://habr.com/ru/post/1539038/


All Articles