Skip to content

Commit

Permalink
Merge pull request #342 from BishopFox/stage
Browse files Browse the repository at this point in the history
Canaries / Windows Garble Unpack
  • Loading branch information
moloch-- authored Mar 7, 2021
2 parents 428e9a5 + a62e3e4 commit c8deada
Show file tree
Hide file tree
Showing 12 changed files with 119 additions and 16 deletions.
11 changes: 10 additions & 1 deletion implant/sliver/constants/constants.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package constants

// Ironically not consts, becuase our string obfuscator only works on `var`s
import "reflect"

/*
Sliver Implant Framework
Expand All @@ -20,6 +20,15 @@ package constants
along with this program. If not, see <https://www.gnu.org/licenses/>.
*/

// Ironically not consts to ensure the string obfuscator hits this value
var (
SliverName = `{{.Name}}`
)

// Message - Fake message for embedding canaries
type Message struct {
Command string `c2:"[[GenerateCanary]]"`
}

// never obfuscate the Message type
var _ = reflect.TypeOf(Message{})
18 changes: 18 additions & 0 deletions implant/sliver/encoders/english-words.go
Original file line number Diff line number Diff line change
@@ -1,5 +1,23 @@
package encoders

/*
Sliver Implant Framework
Copyright (C) 2021 Bishop Fox
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <https://www.gnu.org/licenses/>.
*/

func getEnglishDictionary() []string {
return []string{

Expand Down
10 changes: 5 additions & 5 deletions implant/sliver/encoders/gzip.go
Original file line number Diff line number Diff line change
@@ -1,10 +1,5 @@
package encoders

import (
"bytes"
"compress/gzip"
)

/*
Sliver Implant Framework
Copyright (C) 2019 Bishop Fox
Expand All @@ -23,6 +18,11 @@ import (
along with this program. If not, see <https://www.gnu.org/licenses/>.
*/

import (
"bytes"
"compress/gzip"
)

// GzipEncoderID - EncoderID
const GzipEncoderID = 49

Expand Down
18 changes: 18 additions & 0 deletions implant/sliver/evasion/evasion.go
Original file line number Diff line number Diff line change
@@ -1 +1,19 @@
package evasion

/*
Sliver Implant Framework
Copyright (C) 2021 Bishop Fox
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
20 changes: 19 additions & 1 deletion implant/sliver/evasion/evasion_darwin.go
Original file line number Diff line number Diff line change
@@ -1 +1,19 @@
package evasion
package evasion

/*
Sliver Implant Framework
Copyright (C) 2021 Bishop Fox
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
18 changes: 18 additions & 0 deletions implant/sliver/evasion/evasion_linux.go
Original file line number Diff line number Diff line change
@@ -1 +1,19 @@
package evasion

/*
Sliver Implant Framework
Copyright (C) 2021 Bishop Fox
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
18 changes: 18 additions & 0 deletions implant/sliver/evasion/evasion_windows.go
Original file line number Diff line number Diff line change
@@ -1,5 +1,23 @@
package evasion

/*
Sliver Implant Framework
Copyright (C) 2021 Bishop Fox
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <https://www.gnu.org/licenses/>.
*/

import (
"github.com/bishopfox/sliver/implant/sliver/syscalls"
"golang.org/x/sys/windows"
Expand Down
4 changes: 2 additions & 2 deletions implant/sliver/hostuuid/uuid_windows.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,8 @@ import (
)

// Stored Format: {U-U-I-D}
const uuid_keypath = "HKEY_LOCAL_MACHINE\\SYSTEM\\HardwareConfig"
const uuid_key = "LastConfig"
var uuid_keypath = "HKEY_LOCAL_MACHINE\\SYSTEM\\HardwareConfig"
var uuid_key = "LastConfig"

func GetUUID() string {
key, err := registry.OpenKey(registry.CURRENT_USER, uuid_keypath, registry.QUERY_VALUE)
Expand Down
4 changes: 2 additions & 2 deletions implant/sliver/netstat/netstat_linux.go
Original file line number Diff line number Diff line change
Expand Up @@ -192,7 +192,7 @@ type procFd struct {
p *Process
}

const sockPrefix = "socket:["
var sockPrefix = "socket:["

func getProcName(s []byte) string {
i := bytes.Index(s, []byte("("))
Expand Down Expand Up @@ -251,7 +251,7 @@ func (p *procFd) iterFdDir() {
}

func extractProcInfo(sktab []SockTabEntry) {
const basedir = "/proc"
var basedir = "/proc"
fi, err := ioutil.ReadDir(basedir)
if err != nil {
return
Expand Down
4 changes: 2 additions & 2 deletions implant/sliver/proxy/provider_darwin_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,13 @@ import (
"github.com/stretchr/testify/assert"
)

const (
var (
ScutilDataHttpsHttp = "ScutilDataHttpsHttp"
ScutilDataHttps = "ScutilDataHttps"
ScutilDataHttp = "ScutilDataHttp"
)

const (
var (
ScutilBypassTest1 = "localhost"
ScutilBypassTest2 = "myorg1.com"
ScutilBypassTest3 = "endpoint.myorg2.com"
Expand Down
8 changes: 6 additions & 2 deletions server/assets/assets.go
Original file line number Diff line number Diff line change
Expand Up @@ -161,13 +161,17 @@ func setupGo(appDir string) error {
return err
}

garbleAssetPath := path.Join("fs", runtime.GOOS, runtime.GOARCH, "garble")
garbleFileName := "garble"
if runtime.GOOS == "windows" {
garbleFileName = "garble.exe"
}
garbleAssetPath := path.Join("fs", runtime.GOOS, runtime.GOARCH, garbleFileName)
garbleFile, err := assetsFs.ReadFile(garbleAssetPath)
if err != nil {
setupLog.Errorf("Static asset not found: %s", garbleFile)
return err
}
garbleLocalPath := path.Join(appDir, "go", "bin", "garble")
garbleLocalPath := path.Join(appDir, "go", "bin", garbleFileName)
err = ioutil.WriteFile(garbleLocalPath, garbleFile, 0755)
if err != nil {
setupLog.Errorf("Failed to write garble %s", err)
Expand Down
2 changes: 1 addition & 1 deletion server/generate/canaries.go
Original file line number Diff line number Diff line change
Expand Up @@ -97,5 +97,5 @@ func (g *CanaryGenerator) GenerateCanary() string {
dbSession := db.Session()
dbSession.Create(&canary)

return fmt.Sprintf("%s%s", canaryPrefix, canaryDomain)
return canaryDomain
}

0 comments on commit c8deada

Please sign in to comment.