qrexec: forbid '$' in target and service name
Those parameters eventually may eventually be passed to a shell script (at least /usr/lib/qubes/qubes-rpc-multiplexer). While it is possible to properly escape shell special characters, lets do safer and less fragile thing: forbid such characters entirely. In case of target name, qrexec policy keywords are allowed, and after recent change, those contains '@', so allow this char.
This commit is contained in:
parent
d54d953af1
commit
c129ce2e4d
@ -650,8 +650,7 @@ static void sanitize_name(char * untrusted_s_signed, char *extra_allowed_chars)
|
|||||||
continue;
|
continue;
|
||||||
if (*untrusted_s >= '0' && *untrusted_s <= '9')
|
if (*untrusted_s >= '0' && *untrusted_s <= '9')
|
||||||
continue;
|
continue;
|
||||||
if (*untrusted_s == '$' ||
|
if (*untrusted_s == '_' ||
|
||||||
*untrusted_s == '_' ||
|
|
||||||
*untrusted_s == '-' ||
|
*untrusted_s == '-' ||
|
||||||
*untrusted_s == '.')
|
*untrusted_s == '.')
|
||||||
continue;
|
continue;
|
||||||
@ -683,7 +682,7 @@ static void handle_execute_service(void)
|
|||||||
ENSURE_NULL_TERMINATED(untrusted_params.target_domain);
|
ENSURE_NULL_TERMINATED(untrusted_params.target_domain);
|
||||||
ENSURE_NULL_TERMINATED(untrusted_params.request_id.ident);
|
ENSURE_NULL_TERMINATED(untrusted_params.request_id.ident);
|
||||||
sanitize_name(untrusted_params.service_name, "+");
|
sanitize_name(untrusted_params.service_name, "+");
|
||||||
sanitize_name(untrusted_params.target_domain, ":");
|
sanitize_name(untrusted_params.target_domain, "@:");
|
||||||
sanitize_name(untrusted_params.request_id.ident, " ");
|
sanitize_name(untrusted_params.request_id.ident, " ");
|
||||||
params = untrusted_params;
|
params = untrusted_params;
|
||||||
/* sanitize end */
|
/* sanitize end */
|
||||||
|
Loading…
Reference in New Issue
Block a user