{"record":{"id":"e17b1d966fb289d7","repo":"kgretzky/evilginx2","slug":"proxy-port-can-t-be-0","errorCode":null,"errorMessage":"proxy port can't be 0","messagePattern":"proxy port can't be 0","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"core/http_proxy.go","lineNumber":1920,"sourceCode":"\tpl := p.getPhishletByPhishHost(hostname)\n\tif pl != nil {\n\t\tsid, ok := p.ip_sids[ip_addr+\"-\"+pl.Name]\n\t\treturn sid, ok\n\t}\n\treturn \"\", false\n}\n\nfunc (p *HttpProxy) setProxy(enabled bool, ptype string, address string, port int, username string, password string) error {\n\tif enabled {\n\t\tptypes := []string{\"http\", \"https\", \"socks5\", \"socks5h\"}\n\t\tif !stringExists(ptype, ptypes) {\n\t\t\treturn fmt.Errorf(\"invalid proxy type selected\")\n\t\t}\n\t\tif len(address) == 0 {\n\t\t\treturn fmt.Errorf(\"proxy address can't be empty\")\n\t\t}\n\t\tif port == 0 {\n\t\t\treturn fmt.Errorf(\"proxy port can't be 0\")\n\t\t}\n\n\t\tu := url.URL{\n\t\t\tScheme: ptype,\n\t\t\tHost:   address + \":\" + strconv.Itoa(port),\n\t\t}\n\n\t\tif strings.HasPrefix(ptype, \"http\") {\n\t\t\tvar dproxy *http_dialer.HttpTunnel\n\t\t\tif username != \"\" {\n\t\t\t\tdproxy = http_dialer.New(&u, http_dialer.WithProxyAuth(http_dialer.AuthBasic(username, password)))\n\t\t\t} else {\n\t\t\t\tdproxy = http_dialer.New(&u)\n\t\t\t}\n\t\t\tp.Proxy.Tr.Dial = dproxy.Dial\n\t\t} else {\n\t\t\tif username != \"\" {\n\t\t\t\tu.User = url.UserPassword(username, password)","sourceCodeStart":1902,"sourceCodeEnd":1938,"githubUrl":"https://github.com/kgretzky/evilginx2/blob/4c0988a1d9db4d172a185e979a38bfd0efdb5830/core/http_proxy.go#L1902-L1938","documentation":"setProxy requires a non-zero port when the upstream proxy is enabled. Port 0 is not a usable proxy endpoint, so configuration is rejected before the proxy URL is constructed. This is a required-field validation on the port argument.","triggerScenarios":"Calling setProxy(true, \"http\", \"proxy.example.com\", 0, ...) or passing the `proxy` command with the port argument missing/zero, or a numeric config field that defaulted to 0 because it was never set.","commonSituations":"Forgot to specify the port after the address (e.g. typed only `proxy http 1.2.3.4`), a config template with port: 0 placeholder never filled in, or parsing a 'host:' string without the port and getting 0.","solutions":["Provide the actual listening port of the upstream proxy, e.g. 8080, 9050, 1080","Verify the port from your proxy provider/daemon config and re-run the proxy command with it","If using env/config, ensure the port field is parsed as an integer > 0 before calling setProxy","Confirm address and port order in the command: `proxy <type> <address> <port> [user] [pass]`"],"exampleFix":"// before\np.setProxy(true, \"http\", \"proxy.example.com\", 0, \"\", \"\")\n// after\np.setProxy(true, \"http\", \"proxy.example.com\", 8080, \"\", \"\")","handlingStrategy":"validation","validationCode":"if enabled && port == 0 {\n    return fmt.Errorf(\"proxy port is required when proxy is enabled\")\n}","typeGuard":"func validProxyPort(port int) bool {\n    return port > 0 && port <= 65535\n}","tryCatchPattern":"if err := proxy.setProxy(true, ptype, addr, port, user, pass); err != nil {\n    if strings.Contains(err.Error(), \"port can't be 0\") {\n        return fmt.Errorf(\"supply the upstream proxy port, e.g. 8080\")\n    }\n}","preventionTips":["Always specify address AND port together","Parse port from config with strconv.Atoi and check > 0 before use","Confirm the port against your upstream proxy's listening config","Don't leave port: 0 placeholders in config templates"],"tags":["proxy","configuration","validation"],"backgroundTag":"missing-required-config","analyzedSha":"4c0988a1d9db4d172a185e979a38bfd0efdb5830","analyzedAt":"2026-09-05T19:23:07.238Z","contentChangedAt":"2026-09-05T19:23:07.238Z","schemaVersion":2},"datasetVersion":"2026-09-14T00:17:10.932Z"}