Skip to content

Commit

Permalink
Merge pull request #318 from BishopFox/stage
Browse files Browse the repository at this point in the history
Stage
  • Loading branch information
moloch-- authored Jan 3, 2021
2 parents 66d723d + b86eac7 commit ee58268
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 2 deletions.
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM golang:1.15.5
FROM golang:1.15.6

#
# IMPORTANT: This Dockerfile is used for testing, I do not recommend deploying
Expand Down
2 changes: 1 addition & 1 deletion go-assets.sh
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
# Creates the static go asset archives
# You'll need wget, tar, and unzip commands

GO_VER="1.15.5"
GO_VER="1.15.6"
GO_ARCH="amd64"
BLOAT_FILES="AUTHORS CONTRIBUTORS PATENTS VERSION favicon.ico robots.txt CONTRIBUTING.md LICENSE README.md ./doc ./test ./api ./misc"

Expand Down
1 change: 1 addition & 0 deletions server/db/sql.go
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@ func newDBClient() *gorm.DB {
&models.ImplantC2{},
&models.ImplantConfig{},
&models.ImplantBuild{},
&models.CanaryDomain{},
&models.ImplantProfile{},
&models.WebContent{},
&models.Website{},
Expand Down
12 changes: 12 additions & 0 deletions server/handlers/sessions.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,8 @@ package handlers
*/

import (
"sync"

"github.com/bishopfox/sliver/protobuf/sliverpb"
"github.com/bishopfox/sliver/server/core"
"github.com/bishopfox/sliver/server/log"
Expand All @@ -38,6 +40,8 @@ var (
sliverpb.MsgTunnelData: tunnelDataHandler,
sliverpb.MsgTunnelClose: tunnelCloseHandler,
}

tunnelHandlerMutex = &sync.Mutex{}
)

// GetSessionHandlers - Returns a map of server-side msg handlers
Expand Down Expand Up @@ -83,7 +87,12 @@ func registerSessionHandler(session *core.Session, data []byte) {
core.Sessions.Add(session)
}

// The handler mutex prevents a send on a closed channel, without it
// two handlers calls may race when a tunnel is quickly created and closed.
func tunnelDataHandler(session *core.Session, data []byte) {
tunnelHandlerMutex.Lock()
defer tunnelHandlerMutex.Unlock()

tunnelData := &sliverpb.TunnelData{}
proto.Unmarshal(data, tunnelData)
tunnel := core.Tunnels.Get(tunnelData.TunnelID)
Expand All @@ -99,6 +108,9 @@ func tunnelDataHandler(session *core.Session, data []byte) {
}

func tunnelCloseHandler(session *core.Session, data []byte) {
tunnelHandlerMutex.Lock()
defer tunnelHandlerMutex.Unlock()

tunnelData := &sliverpb.TunnelData{}
proto.Unmarshal(data, tunnelData)
if !tunnelData.Closed {
Expand Down

0 comments on commit ee58268

Please sign in to comment.