Skip to content

x/crypto/ssh: server gcmCipher appears to do erroneous check for padding size #18953

Closed
@twitchyliquid64

Description

@twitchyliquid64

I think the problem is here: https://github.com/golang/crypto/blob/master/ssh/cipher.go#L347

Based on my reading of the RFC, padding up to 255 is permitted. https://tools.ietf.org/html/rfc4253#section-6

What version of Go are you using (go version)?

go version devel +4cce27a3fa Sat Jan 21 03:20:55 2017 +0000 linux/amd64

What operating system and processor architecture are you using (go env)?

GOARCH="amd64"
GOBIN=""
GOEXE=""
GOHOSTARCH="amd64"
GOHOSTOS="linux"
GOOS="linux"
GOPATH=""
GORACE=""
GOROOT="/usr/lib/google-golang"
GOTOOLDIR="/usr/lib/google-golang/pkg/tool/linux_amd64"
GCCGO="gccgo"
CC="gcc"
GOGCCFLAGS="-fPIC -m64 -pthread -fmessage-length=0 -fdebug-prefix-map=/tmp/go-build525614664=/tmp/go-build -gno-record-gcc-switches"
CXX="g++"
CGO_ENABLED="1"
PKG_CONFIG="pkg-config"
CGO_CFLAGS="-g -O2"
CGO_CPPFLAGS=""
CGO_CXXFLAGS="-g -O2"
CGO_FFLAGS="-g -O2"
CGO_LDFLAGS="-g -O2"

What did you do?

  1. Setup key: ssh-keygen -f key -N '' -t rsa
  2. Run server: https://play.golang.org/p/yP-jDiYz86
  3. SSH using a client that has more padding (ask jsonp@ or agl@ which one I am referring to - dont think I can write it here)

What did you expect to see?

Successful SSH login.

What did you see instead?

Server has error "ssh: illegal padding 79".
Client says server closed connection.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions