Allow only printable ascii in echo
This commit is contained in:
parent
bd5fcb00e0
commit
a6f13a64dc
1 changed files with 3 additions and 1 deletions
|
|
@ -1194,7 +1194,9 @@ def handle_remote_cmd(self, cmd: str) -> None:
|
|||
def handle_remote_echo(self, msg: str) -> None:
|
||||
from base64 import standard_b64decode
|
||||
data = standard_b64decode(msg)
|
||||
data = re.sub(rb'[^a-zA-Z0-9]', b'', data)
|
||||
# ensure we are not writing any control char back as this can lead to command injection on shell prompts
|
||||
# Any bytes outside the printable ASCII range are removed.
|
||||
data = re.sub(rb'[^ -~]', b'', data)
|
||||
self.write_to_child(data)
|
||||
|
||||
def handle_remote_ssh(self, msg: str) -> None:
|
||||
|
|
|
|||
Loading…
Reference in a new issue