You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+11-19Lines changed: 11 additions & 19 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -6,6 +6,15 @@ This is a small python script that I use to prototype some potential use-cases w
6
6
7
7
What is it doing? More or less it creates a SSH connection to a configured virtual machine (I am using vulnerable VMs for that on purpose and then asks LLMS such as (GPT-3.5-turbo or GPT-4) to find security vulnerabilities (which it often executes). Evicts a bit of an eerie feeling for me.
- log storage in sqlite either into a file or in-memory
15
+
- automatic (very rough) root detection
16
+
- can limit rounds (how often the LLM will be asked for a new command)
17
+
9
18
### Vision Paper
10
19
11
20
hackingBuddyGPT is described in the paper [Getting pwn'd by AI: Penetration Testing with Large Language Models ](https://arxiv.org/abs/2308.00121).
@@ -31,6 +40,8 @@ series = {ESEC/FSE 2023}
31
40
32
41
# Example runs
33
42
43
+
- more can be seen at [history notes](https://github.com/ipa-lab/hackingBuddyGPT/blob/v3/history_notes.md)
44
+
34
45
## updated version using GPT-4
35
46
36
47
This happened during a recent run:
@@ -45,25 +56,6 @@ Some things to note:
45
56
46
57
In this case GPT-4 wanted to exploit a vulnerable cron script (to which it had write access), sadly I forgot to enable cron in the VM.
47
58
48
-
## initial version (tagged as fse23-ivr) using gpt-3.5-turbo
49
-
50
-
This happened during a recent run:
51
-
52
-

53
-
54
-
Some things to note:
55
-
56
-
- prompts for GPT-3 are prefixed with `openai-prompt`, the returned command from GPT-3 is prefixed with `openai-next-command` and the result from executing the command with `server-output`
57
-
- the used SSH-library also displays the output produced by the commands executed through SSH --- this is why some stuff appears twice
58
-
- I've added a simple callback that automatically enters the configured account's credentials if sudo prompts for a password
59
-
60
-
So, what is acutally happening when executing wintermute?
61
-
62
-
- wintermute executed `id` initially to get the user's id
63
-
- the next command was `sudo -l`, listing the current users sudo permissions
64
-
- wintermute then executes `sudo /bin/bash` and we're dropped into an interactive root shell
65
-
66
-
67
59
## High-Level Description
68
60
69
61
This tool uses SSH to connect to a (presumably) vulnerable virtual machine and then asks OpenAI GPT to suggest linux commands that could be used for finding security vulnerabilities or privilege escalatation. The provided command is then executed within the virtual machine, the output fed back to the LLM and, finally, a new command is requested from it..
rows=self.cursor.execute("select query, response from queries where run_id = ? and cmd_id = ? order by round asc", (run_id, self.query_cmd_id)).fetchall()
70
+
71
+
result= []
72
+
73
+
forrowinrows:
74
+
result.append([row[0], row[1]])
75
+
76
+
returnresult
77
+
78
+
defrun_was_success(self, run_id):
79
+
self.cursor.execute("update runs set state=? where id = ?", ("got root", run_id))
80
+
self.db.commit()
81
+
82
+
defrun_was_failure(self, run_id):
83
+
self.cursor.execute("update runs set state=? where id = ?", ("reached max runs", run_id))
Copy file name to clipboardExpand all lines: history_notes.md
+18Lines changed: 18 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,3 +1,21 @@
1
+
# initial version (tagged as fse23-ivr) using gpt-3.5-turbo
2
+
3
+
This happened during a recent run:
4
+
5
+

6
+
7
+
Some things to note:
8
+
9
+
- prompts for GPT-3 are prefixed with `openai-prompt`, the returned command from GPT-3 is prefixed with `openai-next-command` and the result from executing the command with `server-output`
10
+
- the used SSH-library also displays the output produced by the commands executed through SSH --- this is why some stuff appears twice
11
+
- I've added a simple callback that automatically enters the configured account's credentials if sudo prompts for a password
12
+
13
+
So, what is acutally happening when executing wintermute?
14
+
15
+
- wintermute executed `id` initially to get the user's id
16
+
- the next command was `sudo -l`, listing the current users sudo permissions
17
+
- wintermute then executes `sudo /bin/bash` and we're dropped into an interactive root shell
0 commit comments