Skip to content

Commit f3451ee

Browse files
author
Brent Cook
committed
Land rapid7#5380, pageantjacker, an SSH agent proxy
2 parents 4acbfd4 + 46ed129 commit f3451ee

File tree

11 files changed

+193
-8
lines changed

11 files changed

+193
-8
lines changed

Gemfile.lock

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ PATH
1010
metasm (~> 1.0.2)
1111
metasploit-concern (= 1.0.0)
1212
metasploit-model (= 1.0.0)
13-
metasploit-payloads (= 1.0.13)
13+
metasploit-payloads (= 1.0.14)
1414
msgpack
1515
nokogiri
1616
packetfu (= 1.1.11)
@@ -125,7 +125,7 @@ GEM
125125
activemodel (>= 4.0.9, < 4.1.0)
126126
activesupport (>= 4.0.9, < 4.1.0)
127127
railties (>= 4.0.9, < 4.1.0)
128-
metasploit-payloads (1.0.13)
128+
metasploit-payloads (1.0.14)
129129
metasploit_data_models (1.2.5)
130130
activerecord (>= 4.0.9, < 4.1.0)
131131
activesupport (>= 4.0.9, < 4.1.0)

lib/rex/post/meterpreter/extensions/extapi/extapi.rb

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
require 'rex/post/meterpreter/extensions/extapi/clipboard/clipboard'
77
require 'rex/post/meterpreter/extensions/extapi/adsi/adsi'
88
require 'rex/post/meterpreter/extensions/extapi/ntds/ntds'
9+
require 'rex/post/meterpreter/extensions/extapi/pageant/pageant'
910
require 'rex/post/meterpreter/extensions/extapi/wmi/wmi'
1011

1112
module Rex
@@ -36,6 +37,7 @@ def initialize(client)
3637
'clipboard' => Rex::Post::Meterpreter::Extensions::Extapi::Clipboard::Clipboard.new(client),
3738
'adsi' => Rex::Post::Meterpreter::Extensions::Extapi::Adsi::Adsi.new(client),
3839
'ntds' => Rex::Post::Meterpreter::Extensions::Extapi::Ntds::Ntds.new(client),
40+
'pageant' => Rex::Post::Meterpreter::Extensions::Extapi::Pageant::Pageant.new(client),
3941
'wmi' => Rex::Post::Meterpreter::Extensions::Extapi::Wmi::Wmi.new(client)
4042
})
4143
},
Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
# -*- coding: binary -*-
2+
3+
module Rex
4+
module Post
5+
module Meterpreter
6+
module Extensions
7+
module Extapi
8+
module Pageant
9+
###
10+
# PageantJacker extension - Hijack and interact with Pageant
11+
#
12+
# Stuart Morgan <[email protected]>
13+
#
14+
###
15+
class Pageant
16+
def initialize(client)
17+
@client = client
18+
end
19+
20+
def forward(blob, size)
21+
return nil unless size > 0 && blob.size > 0
22+
23+
packet_request = Packet.create_request('extapi_pageant_send_query')
24+
packet_request.add_tlv(TLV_TYPE_EXTENSION_PAGEANT_SIZE_IN, size)
25+
packet_request.add_tlv(TLV_TYPE_EXTENSION_PAGEANT_BLOB_IN, blob)
26+
27+
response = client.send_request(packet_request)
28+
return nil unless response
29+
30+
{
31+
success: response.get_tlv_value(TLV_TYPE_EXTENSION_PAGEANT_STATUS),
32+
blob: response.get_tlv_value(TLV_TYPE_EXTENSION_PAGEANT_RETURNEDBLOB),
33+
error: response.get_tlv_value(TLV_TYPE_EXTENSION_PAGEANT_ERRORMESSAGE)
34+
}
35+
end
36+
37+
attr_accessor :client
38+
end
39+
end
40+
end
41+
end
42+
end
43+
end
44+
end

lib/rex/post/meterpreter/extensions/extapi/tlv.rb

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,12 @@ module Extapi
7575
TLV_TYPE_NTDS_TEST = TLV_META_TYPE_STRING | (TLV_TYPE_EXTENSION_EXTAPI + TLV_EXTENSIONS + 80)
7676
TLV_TYPE_NTDS_PATH = TLV_META_TYPE_STRING | (TLV_TYPE_EXTENSION_EXTAPI + TLV_EXTENSIONS + 81)
7777

78+
TLV_TYPE_EXTENSION_PAGEANT_STATUS = TLV_META_TYPE_BOOL | (TLV_TYPE_EXTENSION_EXTAPI + TLV_EXTENSIONS + 85)
79+
TLV_TYPE_EXTENSION_PAGEANT_ERRORMESSAGE = TLV_META_TYPE_UINT | (TLV_TYPE_EXTENSION_EXTAPI + TLV_EXTENSIONS + 86)
80+
TLV_TYPE_EXTENSION_PAGEANT_RETURNEDBLOB = TLV_META_TYPE_RAW | (TLV_TYPE_EXTENSION_EXTAPI + TLV_EXTENSIONS + 87)
81+
TLV_TYPE_EXTENSION_PAGEANT_SIZE_IN = TLV_META_TYPE_UINT | (TLV_TYPE_EXTENSION_EXTAPI + TLV_EXTENSIONS + 88)
82+
TLV_TYPE_EXTENSION_PAGEANT_BLOB_IN = TLV_META_TYPE_RAW | (TLV_TYPE_EXTENSION_EXTAPI + TLV_EXTENSIONS + 89)
83+
7884
TLV_TYPE_EXT_WMI_DOMAIN = TLV_META_TYPE_STRING | (TLV_TYPE_EXTENSION_EXTAPI + TLV_EXTENSIONS + 90)
7985
TLV_TYPE_EXT_WMI_QUERY = TLV_META_TYPE_STRING | (TLV_TYPE_EXTENSION_EXTAPI + TLV_EXTENSIONS + 91)
8086
TLV_TYPE_EXT_WMI_FIELD = TLV_META_TYPE_STRING | (TLV_TYPE_EXTENSION_EXTAPI + TLV_EXTENSIONS + 92)

metasploit-framework.gemspec

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ Gem::Specification.new do |spec|
6363
# are needed when there's no database
6464
spec.add_runtime_dependency 'metasploit-model', '1.0.0'
6565
# Needed for Meterpreter
66-
spec.add_runtime_dependency 'metasploit-payloads', '1.0.13'
66+
spec.add_runtime_dependency 'metasploit-payloads', '1.0.14'
6767
# Needed by msfgui and other rpc components
6868
spec.add_runtime_dependency 'msgpack'
6969
# Needed by anemone crawler

modules/payloads/singles/windows/x64/meterpreter_bind_tcp.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313

1414
module Metasploit4
1515

16-
CachedSize = 1105970
16+
CachedSize = 1106482
1717

1818
include Msf::Payload::TransportConfig
1919
include Msf::Payload::Windows

modules/payloads/singles/windows/x64/meterpreter_reverse_http.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313

1414
module Metasploit4
1515

16-
CachedSize = 1107014
16+
CachedSize = 1107526
1717

1818
include Msf::Payload::TransportConfig
1919
include Msf::Payload::Windows

modules/payloads/singles/windows/x64/meterpreter_reverse_https.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313

1414
module Metasploit4
1515

16-
CachedSize = 1107014
16+
CachedSize = 1107526
1717

1818
include Msf::Payload::TransportConfig
1919
include Msf::Payload::Windows

modules/payloads/singles/windows/x64/meterpreter_reverse_ipv6_tcp.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313

1414
module Metasploit4
1515

16-
CachedSize = 1105970
16+
CachedSize = 1106482
1717

1818
include Msf::Payload::TransportConfig
1919
include Msf::Payload::Windows

modules/payloads/singles/windows/x64/meterpreter_reverse_tcp.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313

1414
module Metasploit4
1515

16-
CachedSize = 1105970
16+
CachedSize = 1106482
1717

1818
include Msf::Payload::TransportConfig
1919
include Msf::Payload::Windows

0 commit comments

Comments
 (0)