{"record":{"id":"1cbe3f1cc29f7009","repo":"kgretzky/evilginx2","slug":"invalid-proxy-type-selected","errorCode":null,"errorMessage":"invalid proxy type selected","messagePattern":"invalid proxy type selected","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"core/http_proxy.go","lineNumber":1914,"sourceCode":"}\n\nfunc (p *HttpProxy) getSessionIdByIP(ip_addr string, hostname string) (string, bool) {\n\tp.ip_mtx.Lock()\n\tdefer p.ip_mtx.Unlock()\n\n\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 {","sourceCodeStart":1896,"sourceCodeEnd":1932,"githubUrl":"https://github.com/kgretzky/evilginx2/blob/4c0988a1d9db4d172a185e979a38bfd0efdb5830/core/http_proxy.go#L1896-L1932","documentation":"setProxy validates the upstream proxy type against the allowlist {http, https, socks5, socks5h}. If the configured ptype is not in that list, configuration is rejected with this error before any proxy URL is built. It prevents constructing a malformed proxy URL scheme.","triggerScenarios":"Calling setProxy(true, ptype, ...) (via the `proxy` console command) with a type string outside the allowlist — e.g. 'socks4', 'SOCKS5' (uppercase), 'ssl', or a typo like 'sock5'.","commonSituations":"Users configuring an upstream proxy with socks4 (unsupported), using uppercase type names, or mistyping 'socks5h' as 'socks5-h'/'sh'.","solutions":["Set the proxy type to one of exactly: http, https, socks5, socks5h (all lowercase)","If your upstream is SOCKS4, switch to a SOCKS5-capable proxy or use http","Check for typos and case sensitivity in the type argument","If a config file supplies the type, normalize it to lowercase before use"],"exampleFix":"// before\nproxy socks4 127.0.0.1 9050\n// after\nproxy socks5 127.0.0.1 9050","handlingStrategy":"validation","validationCode":"ptypes := []string{\"http\", \"https\", \"socks5\", \"socks5h\"}\nif !stringExists(ptype, ptypes) {\n    return fmt.Errorf(\"proxy type must be one of %v\", ptypes)\n}","typeGuard":"func validProxyType(t string) bool {\n    switch t {\n    case \"http\", \"https\", \"socks5\", \"socks5h\":\n        return true\n    }\n    return false\n}","tryCatchPattern":"if err := proxy.setProxy(true, ptype, addr, port, user, pass); err != nil {\n    if strings.Contains(err.Error(), \"invalid proxy type\") {\n        return fmt.Errorf(\"use http, https, socks5 or socks5h; got %q\", ptype)\n    }\n}","preventionTips":["Use only lowercase http/https/socks5/socks5h","Normalize input to lowercase before validation","Don't attempt socks4 — pick a SOCKS5 upstream","Double-check the type argument spelling in scripts"],"tags":["proxy","configuration","validation"],"backgroundTag":"invalid-config-value","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"}