aboutsummaryrefslogtreecommitdiff
path: root/ssh/agent/server.go
diff options
context:
space:
mode:
authorNeal Patel <nealpatel@google.com>2025-09-10 14:27:42 -0400
committerGopher Robot <gobot@golang.org>2025-11-19 11:28:34 -0800
commitf91f7a7c31bf90b39c1de895ad116a2bacc88748 (patch)
tree814863f3118dff7cd50a6494cdfad81a85d6a709 /ssh/agent/server.go
parent2df4153a0311bdfea44376e0eb6ef2faefb0275b (diff)
downloadgo-x-crypto-f91f7a7c31bf90b39c1de895ad116a2bacc88748.tar.xz
ssh/agent: prevent panic on malformed constraint
An attacker could supply a malformed Constraint that would trigger a panic in a serving agent, effectively causing denial of service. Thank you to Jakub Ciolek for reporting this issue. Fixes CVE-2025-47914 Fixes golang/go#76364 Change-Id: I195bbc68b1560d4f04897722a6a653a7cbf086eb Reviewed-on: https://go-review.googlesource.com/c/crypto/+/721960 LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com> Auto-Submit: Roland Shoemaker <roland@golang.org> Reviewed-by: Damien Neil <dneil@google.com>
Diffstat (limited to 'ssh/agent/server.go')
-rw-r--r--ssh/agent/server.go3
1 files changed, 3 insertions, 0 deletions
diff --git a/ssh/agent/server.go b/ssh/agent/server.go
index 88ce4da..4e8ff86 100644
--- a/ssh/agent/server.go
+++ b/ssh/agent/server.go
@@ -203,6 +203,9 @@ func parseConstraints(constraints []byte) (lifetimeSecs uint32, confirmBeforeUse
for len(constraints) != 0 {
switch constraints[0] {
case agentConstrainLifetime:
+ if len(constraints) < 5 {
+ return 0, false, nil, io.ErrUnexpectedEOF
+ }
lifetimeSecs = binary.BigEndian.Uint32(constraints[1:5])
constraints = constraints[5:]
case agentConstrainConfirm: