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

IP-based whitelist can be bypassed with a custom name server #10

Open
lifthrasiir opened this issue May 21, 2014 · 1 comment
Open

IP-based whitelist can be bypassed with a custom name server #10

lifthrasiir opened this issue May 21, 2014 · 1 comment
Labels

Comments

@lifthrasiir
Copy link

Let's assume that the IP whitelist contains only 1.2.3.4. When the attacker has his/her own name server, it can return two A records 5.6.7.8 and 1.2.3.4 for the requested domain. The current verification only checks if any of them matches to the whitelist, therefore it passes through the verification as 1.2.3.4 is in the whitelist. And alas, the first IP 5.6.7.8 gets used for rebuilding the URL.

Url::validateHost should really filter the IP lists returned by gethostbynamel according to the whitelist.

@wkcaj wkcaj added the bug label May 21, 2014
@wkcaj
Copy link
Owner

wkcaj commented May 21, 2014

Hey,

That's a good point. DNS pinning has now been added, but like you mentioned, if only one IP is whitelisted, and the DNS pinning uses the other, then it could bypass the whitelist.

We've got two options for this. Check all IP's against the whitelist, and if all them don't match, throw an Exception.

The second is to only return whitelisted IP's (any which don't match the whitelist would be discarded). This would allow legit URL's, but could only be used where DNS pinning is enabled - else cURL could use the invalid IP.

I'm leaning toward the first option. What do you think?

Cheers,
Jack

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants