CVE-2024-35175 (published 2024-05-14T22:15Z)

sshpiper is a reverse proxy for sshd. Starting in version 1.0.50 and prior to version 1.3.0, the way the proxy protocol listener is implemented in sshpiper can allow an attacker to forge their connecting address. Commit 2ddd69876a1e1119059debc59fe869cb4e754430 added the proxy protocol listener as the only listener in sshpiper, with no option to toggle this functionality off. This means that any connection that sshpiper is directly (or in some cases indirectly) exposed to can use proxy protocol to forge its source address. Any users of sshpiper who need logs from it for whitelisting/rate limiting/security investigations could have them become much less useful if an attacker is sending a spoofed source address. Version 1.3.0 contains a patch for the issue.


Weakness information:
cwe_id: NVD-CWE-noinfo
cwe_name: Insufficient Information
description: There is insufficient information about the issue to classify it; details are unkown or unspecified.
extended_description: Insufficient Information

Fix information:
repo_url: https://github.com/tg123/sshpiper
commit_details: repo_url: https://github.com/tg123/sshpiper
author: Boshi Lian
author_date: 2022-07-08 01:58:22+00:00
msg: replace with proxy protocol listener
repository: repo_url: https://github.com/tg123/sshpiper
repo_name: tg123/sshpiper
description: The missing reverse proxy for ssh scp
repo_language: Go
owner: tg123
file_changes: filename: daemon.go
change_type: ModificationType.MODIFY
diff: @@ -69,9 +69,9 @@ func (d *daemon) install(plugins ...*plugin.GrpcPlugin) error {
 		return fmt.Errorf("no plugins found")
 	}
 
-	// if len(plugins) == 1 {
-	// 	return plugins[0].InstallPiperConfig(d.config)
-	// }
+	if len(plugins) == 1 {
+		return plugins[0].InstallPiperConfig(d.config)
+	}
 
 	m := plugin.ChainPlugins{}
 

programming_language: Go
filename: main.go
change_type: ModificationType.MODIFY
diff: @@ -7,9 +7,9 @@ import (
 	"runtime/debug"
 	"time"
 
+	"github.com/pires/go-proxyproto"
 	log "github.com/sirupsen/logrus"
 	"github.com/tg123/sshpiper/cmd/sshpiperd/internal/plugin"
-
 	"github.com/urfave/cli/v2"
 )
 
@@ -138,6 +138,8 @@ func main() {
 				return err
 			}
 
+			d.lis = &proxyproto.Listener{Listener: d.lis}
+
 			var plugins []*plugin.GrpcPlugin
 
 			args := ctx.Args().Slice()

programming_language: Go
filename: go.mod
change_type: ModificationType.MODIFY
diff: @@ -11,6 +11,7 @@ require (
 	github.com/google/uuid v1.3.0
 	github.com/microsoft/kiota-authentication-azure-go v0.3.1
 	github.com/microsoftgraph/msgraph-sdk-go v0.28.0
+	github.com/pires/go-proxyproto v0.6.2
 	github.com/sirupsen/logrus v1.8.1
 	github.com/tg123/remotesigner v0.0.0-20210928104451-7c20285909d1
 	github.com/urfave/cli/v2 v2.10.3

programming_language: Batchfile
filename: go.sum
change_type: ModificationType.MODIFY
diff: @@ -89,6 +89,8 @@ github.com/microsoftgraph/msgraph-sdk-go v0.28.0/go.mod h1:MB2iPD8vd8RTRAqlKTZfh
 github.com/microsoftgraph/msgraph-sdk-go-core v0.26.1 h1:wzEoPk6uyd+SkBur9NpzpPfKseUQYT1yjFkDUueLpfk=
 github.com/microsoftgraph/msgraph-sdk-go-core v0.26.1/go.mod h1:cKWHZ9CfJnSvBJxzXnAXRA+SSy8JeAbS+4kOn3uyOIY=
 github.com/montanaflynn/stats v0.6.6/go.mod h1:etXPPgVO6n31NxCd9KQUMvCM+ve0ruNzt6R8Bnaayow=
+github.com/pires/go-proxyproto v0.6.2 h1:KAZ7UteSOt6urjme6ZldyFm4wDe/z0ZUP0Yv0Dos0d8=
+github.com/pires/go-proxyproto v0.6.2/go.mod h1:Odh9VFOZJCf9G8cLW5o435Xf1J95Jw9Gw5rnCjcwzAY=
 github.com/pkg/browser v0.0.0-20210115035449-ce105d075bb4 h1:Qj1ukM4GlMWXNdMBuXcXfz/Kw9s1qm0CLY32QxuSImI=
 github.com/pkg/browser v0.0.0-20210115035449-ce105d075bb4/go.mod h1:N6UoU20jOqggOuDwUaBQpluzLNDqif3kq9z2wpdYEfQ=
 github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM=

programming_language: Go
repo_url: https://github.com/tg123/sshpiper
commit_details: repo_url: https://github.com/tg123/sshpiper
author: Boshi Lian
author_date: 2024-05-09 13:53:36-07:00
msg: Merge pull request from GHSA-4w53-6jvp-gg52

* feat: Add support for allowed proxy addresses

This commit adds support for allowed proxy addresses, which allows only connections from these IP ranges to send a proxy header based on the PROXY protocol. If the allowed proxy addresses are empty, the PROXY protocol support is disabled.

* Update cmd/sshpiperd/main.go

Co-authored-by: Peter G <97112726+pgibson1-godaddy@users.noreply.github.com>

---------

Co-authored-by: Peter G <97112726+pgibson1-godaddy@users.noreply.github.com>
repository: repo_url: https://github.com/tg123/sshpiper
repo_name: tg123/sshpiper
description: The missing reverse proxy for ssh scp
repo_language: Go
owner: tg123
file_changes: filename: main.go
change_type: ModificationType.MODIFY
diff: @@ -160,6 +160,11 @@ func main() {
 				Usage:   "filter out hostkeys-00@openssh.com which cause client side warnings",
 				EnvVars: []string{"SSHPIPERD_DROP_HOSTKEYS_MESSAGE"},
 			},
+			&cli.StringSliceFlag{
+				Name:  "allowed-proxy-addresses",
+				Value: cli.NewStringSlice(),
+				Usage: "allowed proxy addresses, only connections from these ip ranges are allowed to send a proxy header based on the PROXY protocol, empty will disable the PROXY protocol support",
+			},
 		},
 		Action: func(ctx *cli.Context) error {
 			level, err := log.ParseLevel(ctx.String("log-level"))
@@ -185,7 +190,17 @@ func main() {
 			}
 
 			quit := make(chan error)
-			d.lis = &proxyproto.Listener{Listener: d.lis}
+
+			allowedproxyaddresses := ctx.StringSlice("allowed-proxy-addresses")
+
+			if len(allowedproxyaddresses) > 0 {
+				proxypolicy, err := proxyproto.LaxWhiteListPolicy(allowedproxyaddresses)
+				if err != nil {
+					return err
+				}
+
+				d.lis = &proxyproto.Listener{Listener: d.lis, Policy: proxypolicy}
+			}
 
 			var plugins []*plugin.GrpcPlugin
 

programming_language: Go