kgretzky/evilginx2 · error

proxy_hosts: missing `domain` field

Error message

proxy_hosts: missing `domain` field

What it means

Thrown during proxy_hosts validation when an entry lacks the `domain` field. `domain` is the base domain of the real target site for that host (e.g. example.com); combined with orig_sub it forms the full upstream hostname the proxy forwards to. Without it the proxy cannot resolve the backend host and the phishlet fails validation.

Source

Thrown at core/phishlet.go:404

	if fp.Credentials.Username == nil {
		return fmt.Errorf("credentials: missing `username` section")
	}
	if fp.Credentials.Password == nil {
		return fmt.Errorf("credentials: missing `password` section")
	}
	if fp.LoginItem == nil {
		return fmt.Errorf("missing `login` section")
	}

	for _, ph := range *fp.ProxyHosts {
		if ph.PhishSub == nil {
			return fmt.Errorf("proxy_hosts: missing `phish_sub` field")
		}
		if ph.OrigSub == nil {
			return fmt.Errorf("proxy_hosts: missing `orig_sub` field")
		}
		if ph.Domain == nil {
			return fmt.Errorf("proxy_hosts: missing `domain` field")
		}
		auto_filter := true
		if ph.AutoFilter != nil {
			auto_filter = *ph.AutoFilter
		}
		p.addProxyHost(p.paramVal(*ph.PhishSub), p.paramVal(*ph.OrigSub), p.paramVal(*ph.Domain), ph.Session, ph.IsLanding, auto_filter)
	}
	if len(p.proxyHosts) == 0 {
		return fmt.Errorf("proxy_hosts: list cannot be empty")
	}
	session_set := false
	for _, ph := range p.proxyHosts {
		if ph.handle_session {
			session_set = true
			break
		}
	}
	if !session_set {

View on GitHub (pinned to 4c0988a1d9)

Solutions

  1. Add `domain:` with the target's base domain to each proxy_hosts entry
  2. Ensure phish_sub.orig_sub.domain triplets are complete on every entry
  3. Note this domain must NOT be your phishing domain; the phishing hostname is derived from phish_sub + your phishing domain

Example fix

// before
proxy_hosts:
  - phish_sub: login
    orig_sub: login
// after
proxy_hosts:
  - phish_sub: login
    orig_sub: login
    domain: example.com
Defensive patterns

Strategy: validation

Validate before calling

type proxyHost struct {
	PhishSub *string `yaml:"phish_sub"`
	OrigSub  *string `yaml:"orig_sub"`
	Domain   *string `yaml:"domain"`
}
var fp struct { ProxyHosts *[]proxyHost `yaml:"proxy_hosts"` }
yaml.Unmarshal(data, &fp)
for i, ph := range *fp.ProxyHosts {
	if ph.Domain == nil {
		return fmt.Errorf("proxy_hosts[%d]: missing domain", i)
	}
}

Type guard

func hasDomain(ph ProxyHost) bool {
	return ph.Domain != nil
}

Try / catch

err := cfg.AddPhishlet("local", name)
if err != nil {
	if strings.Contains(err.Error(), "missing `domain` field") {
		log.Fatalf("phishlet %s: each proxy_hosts entry needs the target base domain", name)
	}
	return err
}

Prevention

When it happens

Trigger: A `proxy_hosts:` entry containing phish_sub and orig_sub but no `domain`, or a misspelled/mis-indented `domain` key so the struct field stays nil.

Common situations: Omitting domain when duplicating an entry for another subdomain; typo like `domains:`; line accidentally deleted while editing.

Related errors


AI-assisted analysis of kgretzky/evilginx2@4c0988a1d9 (2026-09-05). Data as JSON: /api/errors/d1410753c28bf82d. Report an issue: GitHub.