Skip to content

Commit

Permalink
v2.0.25
Browse files Browse the repository at this point in the history
static build option and ls quote fixes
  • Loading branch information
its-a-feature committed Mar 6, 2024
1 parent 5a0d30b commit cca463b
Show file tree
Hide file tree
Showing 5 changed files with 37 additions and 16 deletions.
8 changes: 0 additions & 8 deletions Payload_Type/poseidon/go.sum
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
github.com/MythicMeta/MythicContainer v1.3.6 h1:RbA98y/hB/qzZga6vT/d+o/23x8BAfok1+y8MRoXsi8=
github.com/MythicMeta/MythicContainer v1.3.6/go.mod h1:EZqZAa+ZdZhhfLICL4RhnlBydMxZC4wi5vr95WRgdbY=
github.com/MythicMeta/MythicContainer v1.3.7 h1:n5uIgSJKjEWvrvSzM7ab3CzCfFp7ovzGgr5Yf8p7ch4=
github.com/MythicMeta/MythicContainer v1.3.7/go.mod h1:EZqZAa+ZdZhhfLICL4RhnlBydMxZC4wi5vr95WRgdbY=
github.com/coreos/go-systemd/v22 v22.5.0/go.mod h1:Y58oyj3AT4RCenI/lSvhwexgC+NSVTIJ3seZv2GcEnc=
Expand Down Expand Up @@ -76,8 +74,6 @@ go.uber.org/goleak v1.2.1 h1:NBol2c7O1ZokfZ0LEU9K6Whx/KnwvepVetCUhtKja4A=
go.uber.org/goleak v1.2.1/go.mod h1:qlT2yGI9QafXHhZZLxlSuNsMw3FFLxBr+tBRlmO1xH4=
go.uber.org/multierr v1.11.0 h1:blXXJkSxSSfBVBlC76pxqeO+LN3aDfLQo+309xJstO0=
go.uber.org/multierr v1.11.0/go.mod h1:20+QtiLqy0Nd6FdQB9TLXag12DsQkrbs3htMFfDN80Y=
golang.org/x/exp v0.0.0-20240213143201-ec583247a57a h1:HinSgX1tJRX3KsL//Gxynpw5CTOAIPhgL4W8PNiIpVE=
golang.org/x/exp v0.0.0-20240213143201-ec583247a57a/go.mod h1:CxmFvTBINI24O/j8iY7H1xHzx2i4OsyguNBmN/uPtqc=
golang.org/x/exp v0.0.0-20240222234643-814bf88cf225 h1:LfspQV/FYTatPTr/3HzIcmiUFH7PGP+OQ6mgDYo3yuQ=
golang.org/x/exp v0.0.0-20240222234643-814bf88cf225/go.mod h1:CxmFvTBINI24O/j8iY7H1xHzx2i4OsyguNBmN/uPtqc=
golang.org/x/net v0.21.0 h1:AQyQV4dYCvJ7vGmJyKki9+PBdyvhkSd8EIx/qb0AYv4=
Expand All @@ -90,12 +86,8 @@ golang.org/x/sys v0.17.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA=
golang.org/x/text v0.14.0 h1:ScX5w1eTa3QqT8oi6+ziP7dTV1S2+ALU0bI+0zXKWiQ=
golang.org/x/text v0.14.0/go.mod h1:18ZOQIKpY8NJVqYksKHtTdi31H5itFRjB5/qKTNYzSU=
golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
google.golang.org/genproto/googleapis/rpc v0.0.0-20240213162025-012b6fc9bca9 h1:hZB7eLIaYlW9qXRfCq/qDaPdbeY3757uARz5Vvfv+cY=
google.golang.org/genproto/googleapis/rpc v0.0.0-20240213162025-012b6fc9bca9/go.mod h1:YUWgXUFRPfoYK1IHMuxH5K6nPEXSCzIMljnQ59lLRCk=
google.golang.org/genproto/googleapis/rpc v0.0.0-20240228224816-df926f6c8641 h1:DKU1r6Tj5s1vlU/moGhuGz7E3xRfwjdAfDzbsaQJtEY=
google.golang.org/genproto/googleapis/rpc v0.0.0-20240228224816-df926f6c8641/go.mod h1:UCOku4NytXMJuLQE5VuqA5lX3PcHCBo8pxNyvkf4xBs=
google.golang.org/grpc v1.61.0 h1:TOvOcuXn30kRao+gfcvsebNEa5iZIiLkisYEkf7R7o0=
google.golang.org/grpc v1.61.0/go.mod h1:VUbo7IFqmF1QtCAstipjG0GIoq49KvMe9+h1jFLBNJs=
google.golang.org/grpc v1.62.0 h1:HQKZ/fa1bXkX1oFOvSjmZEUL8wLSaZTjCcLAlmZRtdk=
google.golang.org/grpc v1.62.0/go.mod h1:IWTG0VlJLCh1SkC58F7np9ka9mx/WNkjl4PGJaiq+QE=
google.golang.org/protobuf v1.26.0-rc.1/go.mod h1:jlhhOSvTdKEhbULTjvd4ARK9grFBp09yW+WbY/TyQbw=
Expand Down
7 changes: 7 additions & 0 deletions Payload_Type/poseidon/poseidon/agent_code/CHANGELOG.MD
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,13 @@ All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/)
and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.html).

## 2.0.25 - 2024-03-06

### Changed

- Fixed the `ls` command to handle surrounding quotes
- Added `static` option to statically compile poseidon

## 2.0.24 - 2024-02-29

### Changed
Expand Down
25 changes: 23 additions & 2 deletions Payload_Type/poseidon/poseidon/agentfunctions/builder.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ import (
"strings"
)

const version = "2.0.24"
const version = "2.0.25"

var payloadDefinition = agentstructs.PayloadType{
Name: "poseidon",
Expand Down Expand Up @@ -88,6 +88,13 @@ var payloadDefinition = agentstructs.PayloadType{
ParameterType: agentstructs.BUILD_PARAMETER_TYPE_NUMBER,
DefaultValue: 10,
},
{
Name: "static",
Description: "Statically compile the payload",
Required: false,
ParameterType: agentstructs.BUILD_PARAMETER_TYPE_BOOLEAN,
DefaultValue: false,
},
},
BuildSteps: []agentstructs.BuildStep{
{
Expand Down Expand Up @@ -141,6 +148,12 @@ func build(payloadBuildMsg agentstructs.PayloadBuildMessage) agentstructs.Payloa
payloadBuildResponse.BuildStdErr = err.Error()
return payloadBuildResponse
}
static, err := payloadBuildMsg.BuildParameters.GetBooleanArg("static")
if err != nil {
payloadBuildResponse.Success = false
payloadBuildResponse.BuildStdErr = err.Error()
return payloadBuildResponse
}
failedConnectionCountThresholdString, err := payloadBuildMsg.BuildParameters.GetNumberArg("failover_threshold")
if err != nil {
payloadBuildResponse.Success = false
Expand All @@ -154,7 +167,12 @@ func build(payloadBuildMsg agentstructs.PayloadBuildMessage) agentstructs.Payloa

// Build Go link flags that are passed in at compile time through the "-ldflags=" argument
// https://golang.org/cmd/link/
ldflags := fmt.Sprintf("-s -w -X '%s.UUID=%s'", poseidon_repo_profile, payloadBuildMsg.PayloadUUID)
ldflags := ""
if static {
ldflags += fmt.Sprintf("-extldflags=-static -s -w -X '%s.UUID=%s'", poseidon_repo_profile, payloadBuildMsg.PayloadUUID)
} else {
ldflags += fmt.Sprintf("-s -w -X '%s.UUID=%s'", poseidon_repo_profile, payloadBuildMsg.PayloadUUID)
}
ldflags += fmt.Sprintf(" -X '%s.debugString=%v'", poseidon_repo_utils, debug)
ldflags += fmt.Sprintf(" -X '%s.egress_failover=%s'", poseidon_repo_profile, egress_failover)
ldflags += fmt.Sprintf(" -X '%s.failedConnectionCountThresholdString=%v'", poseidon_repo_profile, failedConnectionCountThresholdString)
Expand Down Expand Up @@ -259,6 +277,9 @@ func build(payloadBuildMsg agentstructs.PayloadBuildMessage) agentstructs.Payloa
goarch = "arm64"
}
tags := []string{}
if static {
tags = []string{"osusergo", "netgo"}
}
for index, _ := range payloadBuildMsg.C2Profiles {
tags = append(tags, payloadBuildMsg.C2Profiles[index].Name)
}
Expand Down
11 changes: 6 additions & 5 deletions Payload_Type/poseidon/poseidon/agentfunctions/ls.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import (
"github.com/MythicMeta/MythicContainer/logging"
"github.com/mitchellh/mapstructure"
"path/filepath"
"strings"
)

func init() {
Expand All @@ -24,14 +25,14 @@ func init() {
Success: true,
TaskID: taskData.Task.ID,
}
if path, err := taskData.Args.GetStringArg("path"); err != nil {
path, err := taskData.Args.GetStringArg("path")
if err != nil {
logging.LogError(err, "Failed to get string arg for path")
response.Error = err.Error()
response.Success = false
return response
} else {
response.DisplayParams = &path
}
response.DisplayParams = &path
return response
},
TaskFunctionParseArgDictionary: func(args *agentstructs.PTTaskMessageArgsData, input map[string]interface{}) error {
Expand All @@ -50,7 +51,7 @@ func init() {
args.AddArg(agentstructs.CommandParameter{
Name: "path",
ParameterType: agentstructs.COMMAND_PARAMETER_TYPE_STRING,
DefaultValue: fileBrowserData.FullPath,
DefaultValue: strings.Trim(fileBrowserData.FullPath, "\""),
})
return nil
}
Expand All @@ -67,7 +68,7 @@ func init() {
args.AddArg(agentstructs.CommandParameter{
Name: "path",
ParameterType: agentstructs.COMMAND_PARAMETER_TYPE_STRING,
DefaultValue: input,
DefaultValue: strings.Trim(input, "\""),
})
}
args.AddArg(agentstructs.CommandParameter{
Expand Down
2 changes: 1 addition & 1 deletion agent_capabilities.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,6 @@
"architectures": ["x86_64", "arm_64"],
"c2": ["http", "websocket", "dynamichttp", "poseidon_tcp"],
"mythic_version": "3.2",
"agent_version": "2.0.24",
"agent_version": "2.0.25",
"supported_wrappers": []
}

0 comments on commit cca463b

Please sign in to comment.