daemon: strings: Use -a option to avoid using BFD to parse files.

Avoids hitting CVE-2014-8484 and CVE-2014-8485 and similar problems
with BFD parsing on untrusted files.
This commit is contained in:
Richard W.M. Jones
2014-11-05 14:33:39 +00:00
parent a5426cce5f
commit f27e242649
3 changed files with 9 additions and 9 deletions

View File

@@ -50,7 +50,7 @@ do_strings_e (const char *encoding, const char *path)
}
flags = COMMAND_FLAG_CHROOT_COPY_FILE_TO_STDIN | fd;
r = commandf (&out, &err, flags, "strings", "-e", encoding, NULL);
r = commandf (&out, &err, flags, "strings", "-a", "-e", encoding, NULL);
if (r == -1) {
reply_with_error ("%s: %s", path, err);
return NULL;

View File

@@ -5366,9 +5366,9 @@ The external L<cmp(1)> program is used for the comparison." };
This runs the L<strings(1)> command on a file and returns
the list of printable strings found.
B<Use this API with caution.> In particular, it's generally not
a good idea to use it on untrusted files. For more information
see L<guestfs(3)/CVE-2014-8484>." };
The C<strings> command has, in the past, had problems with
parsing untrusted files. These are mitigated in the current
version of libguestfs, but see L<guestfs(3)/CVE-2014-8484>." };
{ defaults with
name = "strings_e";
@@ -5425,9 +5425,9 @@ This is useful for examining binaries in Windows guests.
The returned strings are transcoded to UTF-8.
B<Use this API with caution.> In particular, it's generally not
a good idea to use it on untrusted files. For more information
see L<guestfs(3)/CVE-2014-8484>." };
The C<strings> command has, in the past, had problems with
parsing untrusted files. These are mitigated in the current
version of libguestfs, but see L<guestfs(3)/CVE-2014-8484>." };
{ defaults with
name = "hexdump";

View File

@@ -2216,8 +2216,8 @@ thus the L</guestfs_strings> and L</guestfs_strings_e> APIs in
libguestfs. Running strings on an untrusted file could cause
arbitrary code execution (confined to the libguestfs appliance).
There are thought to be many similar bugs in binutils, so even if
these two bugs are fixed, avoid using these two libguestfs APIs.
In libguestfs E<ge> 1.29.5 and E<ge> 1.28.3, libguestfs uses the
C<strings> I<-a> option to avoid BFD parsing on the file.
=head1 CONNECTION MANAGEMENT