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

Setting non-localhost "Local Proxy" breaks HUD security model #202

Closed
dvas0004 opened this issue Oct 5, 2018 · 12 comments
Closed

Setting non-localhost "Local Proxy" breaks HUD security model #202

dvas0004 opened this issue Oct 5, 2018 · 12 comments

Comments

@dvas0004
Copy link
Contributor

dvas0004 commented Oct 5, 2018

With regards to the following during installation of HUD:

  • Console shows error messages similar to the following:
    WARN org.zaproxy.zap.extension.api.API - Request to API URL https://cdns.us1.gigya.com/zapCallBackUrl/-8111380956573237837?zapfile=inject.js from 192.168.1.1 not permitted

Workaround:

Make sure your API options are set to allow requests from the correct IP addresses. In ZAP, open the "Tools" menu > Options > API, and modify the "Addresses permitted to use the API" appropriately

However as @psiinon pointed out, it breaks the HUD security model.

In order to recreate the above errors, set the "Local Proxy" address to a non local IP under Tools > Options > Local Proxies, for example:

image

This in turn gave rise to the above errors in console when trying to get HUD on a proxied page

@thc202
Copy link
Member

thc202 commented Oct 5, 2018

With which ZAP version?

@thc202 thc202 changed the title Settling non-localhost "Local Proxy" breaks HUD security model Setting non-localhost "Local Proxy" breaks HUD security model Oct 5, 2018
@dvas0004
Copy link
Contributor Author

dvas0004 commented Oct 5, 2018 via email

@thc202
Copy link
Member

thc202 commented Oct 5, 2018

Thanks.

@psiinon
Copy link
Member

psiinon commented Oct 5, 2018

@dvas0004 these errors are really strange. They are for 'callback' urls (/zapCallBackUrl/) which should bypass the 'permitted addresses'.
Do you get these all of the time? Does the HUD completely break if you dont add your browsers address to the list of permitted ones?

@psiinon
Copy link
Member

psiinon commented Oct 5, 2018

For info all API requests should go via callback addresses which bypass the permitted addresses. So adding your browsers IP addr wont actually fix this problem.
The only reason callbacks fail are if they are no longer valid, ie if they have been already requested. So our (mine and @thc202's) assumption is that the errors you are seeing are for duplicated calls.
That shouldnt really happen either, so if you can find a reliable way of reproducing them then please let us know.

@dvas0004
Copy link
Contributor Author

dvas0004 commented Oct 6, 2018

In fact I am now unable to reproduce this, even when I reset the API settings to default. The difference between before and now is that now I put the Dev build ZAP into a virtual container whereas before I had both Dev ZAP and V2.0.7 running at the same time on the same machine. I'll see if I can dig up anything else, but it very much looks like you're right and my system must have been in a "bad state".

@dscrobonia
Copy link
Contributor

Thanks @psiinon and @thc202 for helping out @dvas0004 out with this!

@psiinon
Copy link
Member

psiinon commented Oct 8, 2018

Interestingly I seem to have just hit this when using ZAP from a remote machine, I'll investigate some more :)

@psiinon
Copy link
Member

psiinon commented Oct 8, 2018

So it looks like the browser is getting the target page from its cache, which has an old callback url in.
This doesnt matter if the browser is on local host but does for remote browsers.
My plan is to fix the core to reject calls to old callback urls from localhost too.
For the HUD we'll need to change the headers to prevent the browser from caching the target urls.
@dvas0004 good find!

@dvas0004
Copy link
Contributor Author

dvas0004 commented Oct 8, 2018 via email

@psiinon
Copy link
Member

psiinon commented Oct 8, 2018

The changes: zaproxy/zaproxy#5039 and https://github.com/psiinon/zap-hud/pull/205 should prevent the errors that caused you to add the remote addr to ZAP.
They still dont fix all remote access issues but I've raised #204 for those.
@dvas0004 ok to close this now?

@dvas0004
Copy link
Contributor Author

dvas0004 commented Oct 8, 2018 via email

@psiinon psiinon closed this as completed Oct 8, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

4 participants