Skip to content

Commit 94c0fc2

Browse files
orbisai0securitydoegox
authored andcommitted
Hardening: explicitly set shell=False on all subprocess.run() calls in fm11rf08s_recovery.py.
All four call sites already pass `cmd` as a Python list, so Python's default of `shell=False` means there is no active command-injection risk. This change makes the security intent explicit, prevents accidental future regression if a call site is later changed to pass a string, and improves code clarity. No functional behaviour is changed.
1 parent ea142fe commit 94c0fc2

1 file changed

Lines changed: 4 additions & 4 deletions

File tree

client/pyscripts/fm11rf08s_recovery.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -279,12 +279,12 @@ def show_key(sec, key_type, key):
279279
nt[sec][key_type], nt_enc[sec][key_type], par_err[sec][key_type]]
280280
if debug:
281281
print(' '.join(cmd))
282-
subprocess.run(cmd, capture_output=True)
282+
subprocess.run(cmd, capture_output=True, shell=False)
283283
cmd = [staticnested_2x1nt_path,
284284
f"keys_{uid:08x}_{real_sec:02}_{nt[sec][0]}.dic", f"keys_{uid:08x}_{real_sec:02}_{nt[sec][1]}.dic"]
285285
if debug:
286286
print(' '.join(cmd))
287-
subprocess.run(cmd, capture_output=True)
287+
subprocess.run(cmd, capture_output=True, shell=False)
288288
filtered_dicts[sec][key_type] = True
289289
for key_type in [0, 1]:
290290
keys_set = set()
@@ -300,7 +300,7 @@ def show_key(sec, key_type, key):
300300
f"keys_{uid:08x}_{real_sec:02}_{nt[sec][key_type]}_filtered.dic"]
301301
if debug:
302302
print(' '.join(cmd))
303-
result = subprocess.run(cmd, capture_output=True, text=True).stdout
303+
result = subprocess.run(cmd, capture_output=True, text=True, shell=False).stdout
304304
keys_def_set = set()
305305
for line in result.split('\n'):
306306
matched = match_key(line)
@@ -332,7 +332,7 @@ def show_key(sec, key_type, key):
332332
nt[sec][key_type], nt_enc[sec][key_type], par_err[sec][key_type]]
333333
if debug:
334334
print(' '.join(cmd))
335-
subprocess.run(cmd, capture_output=True)
335+
subprocess.run(cmd, capture_output=True, shell=False)
336336
keys_set = set()
337337
with (open(f"keys_{uid:08x}_{real_sec:02}_{nt[sec][key_type]}.dic")) as f:
338338
while line := f.readline().rstrip():

0 commit comments

Comments
 (0)