diff options
author | Vesa-Matti J Kari <vmkari@cc.helsinki.fi> | 2008-07-22 23:06:13 +0200 |
---|---|---|
committer | Al Viro <viro@zeniv.linux.org.uk> | 2008-08-01 18:05:35 +0200 |
commit | 1d6c9649e236caa2e93e3647256216e57172b011 (patch) | |
tree | f2ddd51635a3aac71d11e6d6ae4d4dc698c120f5 /kernel/audit.c | |
parent | [PATCH] Audit: Collect signal info when SIGUSR2 is sent to auditd (diff) | |
download | linux-1d6c9649e236caa2e93e3647256216e57172b011.tar.xz linux-1d6c9649e236caa2e93e3647256216e57172b011.zip |
kernel/audit.c control character detection is off-by-one
Hello,
According to my understanding there is an off-by-one bug in the
function:
audit_string_contains_control()
in:
kernel/audit.c
Patch is included.
I do not know from how many places the function is called from, but for
example, SELinux Access Vector Cache tries to log untrusted filenames via
call path:
avc_audit()
audit_log_untrustedstring()
audit_log_n_untrustedstring()
audit_string_contains_control()
If audit_string_contains_control() detects control characters, then the
string is hex-encoded. But the hex=0x7f dec=127, DEL-character, is not
detected.
I guess this could have at least some minor security implications, since a
user can create a filename with 0x7f in it, causing logged filename to
possibly look different when someone reads it on the terminal.
Signed-off-by: Vesa-Matti Kari <vmkari@cc.helsinki.fi>
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
Diffstat (limited to 'kernel/audit.c')
-rw-r--r-- | kernel/audit.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/kernel/audit.c b/kernel/audit.c index e092f1c0ce30..6d903182c6b7 100644 --- a/kernel/audit.c +++ b/kernel/audit.c @@ -1366,7 +1366,7 @@ int audit_string_contains_control(const char *string, size_t len) { const unsigned char *p; for (p = string; p < (const unsigned char *)string + len && *p; p++) { - if (*p == '"' || *p < 0x21 || *p > 0x7f) + if (*p == '"' || *p < 0x21 || *p > 0x7e) return 1; } return 0; |