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

Feature: X-Forwarded-For support #929

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

rotarydrone
Copy link

This PR checks if an X-Forwarded-For header is present and treats this as the remote IP. This supports scenarios where Evilginx is behind a reverse proxy, a scenario which may have some operational security benefits.

The default behavior of Evilginx is to register certificates for subdomains on the fly. While convenient, this can hurt us if the target proactively monitors certificate transparency logs for brand impersonation attempts. To mitigate this, we can run Evilginx2 in developer mode (which will only generate the certs locally) and then front it with Nginx redirector, using a wildcard certificate and subdomain.

We would configure *.example.com DNS record and request a wildcard certificate (and a wildcard cert for any subdomains we may want to use as well, e.g *.phish.example.com).

An example nginx configuration may look like:

server {
	listen 443 ssl;
	server_name example.com;
	root /var/www/html;

	ssl_certificate /etc/nginx/pki/fullchain.cer;
	ssl_certificate_key /etc/nginx/pki/example.com.key;

	location / {
			set $backend_name evilginx;
			proxy_pass https://<evilginx_server_ip>:443;
			proxy_ssl_server_name on;
			proxy_ssl_name $host;
			proxy_set_header Host $host;
			proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
	}
}

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

Successfully merging this pull request may close these issues.

None yet

1 participant