Skip to content

Commit 565e111

Browse files
committed
updating tcp profile definition
1 parent 751b062 commit 565e111

4 files changed

Lines changed: 22 additions & 4 deletions

File tree

Payload_Type/poseidon/poseidon/agent_code/CHANGELOG.MD

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,12 @@ All notable changes to this project will be documented in this file.
44
The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/)
55
and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.html).
66

7+
## [2.3.1] - 2026-03-23
8+
9+
### Changed
10+
11+
- Added `localhost_only` `tcp` option to match updated `tcp` c2 profile
12+
713
## [2.3.0] - 2026-03-17
814

915
### Changed

Payload_Type/poseidon/poseidon/agent_code/pkg/profiles/tcp.go

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@ type TCPInitialConfig struct {
3333
Killdate string
3434
EncryptedExchangeCheck bool
3535
AESPSK string
36+
LocalhostOnly bool
3637
}
3738

3839
func (e *TCPInitialConfig) UnmarshalJSON(data []byte) error {
@@ -53,6 +54,9 @@ func (e *TCPInitialConfig) UnmarshalJSON(data []byte) error {
5354
if v, ok := alias["AESPSK"]; ok {
5455
e.AESPSK = v.(string)
5556
}
57+
if v, ok := alias["localhost_only"]; ok {
58+
e.LocalhostOnly = v.(bool)
59+
}
5660

5761
return nil
5862
}
@@ -71,6 +75,7 @@ type C2PoseidonTCP struct {
7175
PushChannel chan structs.MythicMessage
7276
stopListeningChannel chan bool
7377
chunkSize uint32
78+
LocalhostOnly bool
7479
}
7580

7681
func (e C2PoseidonTCP) MarshalJSON() ([]byte, error) {
@@ -79,6 +84,7 @@ func (e C2PoseidonTCP) MarshalJSON() ([]byte, error) {
7984
"RsaPrivateKey": e.RsaPrivateKey,
8085
"Port": e.Port,
8186
"Killdate": e.Killdate,
87+
"LocalhostOnly": e.LocalhostOnly,
8288
}
8389
return json.Marshal(alias)
8490
}
@@ -112,6 +118,7 @@ func init() {
112118
PushChannel: make(chan structs.MythicMessage, 1000),
113119
stopListeningChannel: make(chan bool, 1),
114120
chunkSize: poseidonChunkSize,
121+
LocalhostOnly: initialConfig.LocalhostOnly,
115122
}
116123
// these two functions only need to happen once, not each time the profile is started
117124
go profile.CreateMessagesForEgressConnections()
@@ -141,7 +148,11 @@ func (c *C2PoseidonTCP) Start() {
141148
c.stoppedChannel <- true
142149
}()
143150
for {
144-
listen, err = net.Listen("tcp", fmt.Sprintf("0.0.0.0:%s", c.Port))
151+
listenAddress := fmt.Sprintf("0.0.0.0:%s", c.Port)
152+
if c.LocalhostOnly {
153+
listenAddress = fmt.Sprintf("127.0.0.1:%s", c.Port)
154+
}
155+
listen, err = net.Listen("tcp", listenAddress)
145156

146157
if err != nil {
147158
utils.PrintDebug(fmt.Sprintf("Failed to bind: %v\n", err))

Payload_Type/poseidon/poseidon/agent_code/test_agent_config_tcp.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,5 +2,6 @@
22
"port": 8085,
33
"killdate": "2026-12-31",
44
"encrypted_exchange_check": true,
5-
"AESPSK": "dNpxaDKHQiOF1v7BpqJHoNWcwZGItdNo99O9KzFr5xc="
5+
"AESPSK": "dNpxaDKHQiOF1v7BpqJHoNWcwZGItdNo99O9KzFr5xc=",
6+
"localhost_only": false
67
}

Payload_Type/poseidon/poseidon/agentfunctions/builder.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ import (
2121
"golang.org/x/exp/slices"
2222
)
2323

24-
const version = "2.3.0"
24+
const version = "2.3.1"
2525

2626
type sleepInfoStruct struct {
2727
Interval int `json:"interval"`
@@ -359,7 +359,7 @@ func build(payloadBuildMsg agentstructs.PayloadBuildMessage) agentstructs.Payloa
359359
}
360360

361361
//ldflags += fmt.Sprintf(" -X '%s.%s_%s=%v'", poseidon_repo_profile, payloadBuildMsg.C2Profiles[index].Name, key, val)
362-
} else if slices.Contains([]string{"encrypted_exchange_check"}, key) {
362+
} else if slices.Contains([]string{"encrypted_exchange_check", "localhost_only"}, key) {
363363
val, err := payloadBuildMsg.C2Profiles[index].GetBooleanArg(key)
364364
if err != nil {
365365
stringVal, err := payloadBuildMsg.C2Profiles[index].GetStringArg(key)

0 commit comments

Comments
 (0)