Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
added support for retrieving correct origin ip for requests coming fr…
…om behind a proxy (nginx/apache2/cloudflare/azure)
- Loading branch information
1b9cb59
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sorry this is an actually faulty commit.
You shouldn't blindly trust the client's relayed IP header as this is a security vulnerability in itself.
I imagine this might break this or potentially cause some exploit where a random user could spoof the header value and cause the evilginx2 session to close down or shut completely...
You are also missing the CF-Connecting-IP header value (that one specifically is Cloudflare's header)...
https://developers.cloudflare.com/fundamentals/reference/http-request-headers/
1b9cb59
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I suggest a total rollback of this commit @kgretzky
I can work out a patch and submit it via PR
1b9cb59
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I saw this and rolled back, Have you been able to work around this ? i don't trust X-Forwarded-For", "X-Real-IP", "X-Client-IP", "Connecting-IP", "True-Client-IP", "Client-IP" as i think it'll be used to detect evilginx host ip
1b9cb59
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@kgretzky please take a look at this approach again
1b9cb59
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@wick3dhub
I only use Cloudflare proxying (not azure/aws/etc.) so my implementation just grabs CF-Connecting-IP and if the request is coming from one of Cloudflare's IPs, I use CF-Connecting-IP as the visitor's IP address.
1b9cb59
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It seems kgretzky isn't paying attention here.
Hey @wick3dhub. Do you code? Want I can open a repo
Im thinking...
Maybe if we make a scanner to detect all the evilginx2 sessions (technically all from this version forward),
since now those evilginx2 machines can be detected as they blindly trust ALL those headers by default.
What if we make a scanner to auto report as phishing all running evilginx2 instances to those blacklists lol...
(/s lol, joke, im aware he's only on X)
1b9cb59
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hey @M41KL-N41TT , How do you use cloudflare proxying, paste logic
1b9cb59
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sorry, just reading this.
Appreciate the comments. You are right that this can result in client spoofing the IP address by adding a bogus HTTP header with a spoofed IP value.
All in all, phished user aware and doing this would not get successfully phished, but it leaves room for malicious behaviour and I agree this should be rolled back and made optional with Evilginx user being able to specify the name of the HTTP header they want to use in their configuration. It should not be automated with HTTP header guessing.