Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improper Input Validation #50

Open
AlonNavon opened this issue Feb 5, 2023 · 0 comments
Open

Improper Input Validation #50

AlonNavon opened this issue Feb 5, 2023 · 0 comments

Comments

@AlonNavon
Copy link

  1. In the latest 2.0.2 there was a rewrite of the IP validation. Effectively, in version 2.0.2 the sanity check that IP components are < 0xFFFFFFFF has been removed, because >>> 0 always converts them to a 32-bit unsigned long.
    This can cause trouble, for example this "IP" actually checks out as belonging to the localhost block: "4294967423.0.0.1" (because mod 2^32 it is equal to 127.0.0.1).
    Although it's obviously an invalid IP, this has the potential to create shenanigans, because other libraries probably are not making the exact same mistake.

  2. Another input validation issue is the use of the ParseInt function for the mask parameter. For example two possible inputs that generate a nonsensical state:
    (a) Try weird = new Netmask('1.2.3.4', -1) , and then the state of the netmask object includes a bitmask <0, and size > 2^32 among other oddities. The next() operation has an uncaught error in this case.
    (b) Try weird2 = new Netmask('1.2.3.4', 0.1). The constructor succeeds, but the state is similarly funky.

Best regards,
Alon Navon,
Seal Security

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

No branches or pull requests

1 participant