public inbox for elfutils@sourceware.org
 help / color / mirror / Atom feed
* [Bug debuginfod/27758] New: security idea: DEBUGINFOD_VERIFY mode
@ 2021-04-20 15:22 fche at redhat dot com
  2021-04-20 18:18 ` [Bug debuginfod/27758] " zbyszek at in dot waw.pl
                   ` (5 more replies)
  0 siblings, 6 replies; 7+ messages in thread
From: fche at redhat dot com @ 2021-04-20 15:22 UTC (permalink / raw)
  To: elfutils-devel

https://sourceware.org/bugzilla/show_bug.cgi?id=27758

            Bug ID: 27758
           Summary: security idea: DEBUGINFOD_VERIFY mode
           Product: elfutils
           Version: unspecified
            Status: NEW
          Severity: normal
          Priority: P2
         Component: debuginfod
          Assignee: unassigned at sourceware dot org
          Reporter: fche at redhat dot com
                CC: elfutils-devel at sourceware dot org
  Target Milestone: ---

Reasonable concerns have been raised about whether a debuginfod client has any
way of verifying that artifacts downloaded are unmodified / still trustworthy. 
This is a good question because any package-level signature protection is
stripped at the server, when we serve constituent files in isolation.

As transport over HTTPS protects the content, we can safely assume that
immediately during/after the download, the content will be fine.  However, what
of cached files?  What if some program changes the cache contents sometime
between download and a much later reuse?  (Note that this threat model is not
that serious, since any tool that could modify cache contents can probably also
modify dot files etc., and take over the user's account.)

But anyway, as a trust/comfort measure, we could provide limited verification
of cached content, without having to fully download again.  Here's one possible
way:

- all this being conditional on a client-side environment variable like
$DEBUGINFOD_VERIFY being set
- in the -client.c code, during a find operation, if there is a cache hit, the
client will STILL make a connection to the upstream $DEBUGINFOD_URLS, but only
with a HEAD query, otherwise same webapi
- the server code, upon seeing the HEAD query, will return additional response
headers
- one of these response headers will be X-Debuginfod-Hash: XYZXYZXYZ, which
would be some securish hash of the content, probably sha256 or such
- the server will compute / cache this hash in a new sqlite table, akin to the
buildids9_file_mtime_scanned, for each file over time, subject to grooming as
usual
- how federated servers do this w.r.t serving from their own cache: TBD
- the client will look for this response header from all servers that return
200
- if no server returns this header (maybe because it's just old, or they don't
happen to have the hash cached or such), and if $DEBUGINFOD_VERIFY value is
"permissive", result -> PASS, return
- the client will pick ANY or ALL (maybe depending on bug #25607 policy?)
- the client will compute the same hash function on the cached content, and
compare
- if the local hash mismatches the server-provided hash, warn via
$DEBUGINFOD_VERBOSE, delete local cached object, perform full download
- otherwise: result -> PASS, return

In the elfutils profile.d/debuginfod.* files, distro policy could set
$DEBUGINFOD_VERIFY=enforcing or =permissive or (none) differently for root
and/or less privileged users.

-- 
You are receiving this mail because:
You are on the CC list for the bug.

^ permalink raw reply	[flat|nested] 7+ messages in thread

* [Bug debuginfod/27758] security idea: DEBUGINFOD_VERIFY mode
  2021-04-20 15:22 [Bug debuginfod/27758] New: security idea: DEBUGINFOD_VERIFY mode fche at redhat dot com
@ 2021-04-20 18:18 ` zbyszek at in dot waw.pl
  2021-04-20 18:23 ` fche at redhat dot com
                   ` (4 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: zbyszek at in dot waw.pl @ 2021-04-20 18:18 UTC (permalink / raw)
  To: elfutils-devel

https://sourceware.org/bugzilla/show_bug.cgi?id=27758

Zbigniew Jędrzejewski-Szmek <zbyszek at in dot waw.pl> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |zbyszek at in dot waw.pl

--- Comment #1 from Zbigniew Jędrzejewski-Szmek <zbyszek at in dot waw.pl> ---
I don't think this protection is particularly interesting. Normal file system
permissions should be used to safeguard any files in the home directory. I
don't see a reason to try to add a verification layer on top. And if it was
added, it cannot be effective anyway.

-- 
You are receiving this mail because:
You are on the CC list for the bug.

^ permalink raw reply	[flat|nested] 7+ messages in thread

* [Bug debuginfod/27758] security idea: DEBUGINFOD_VERIFY mode
  2021-04-20 15:22 [Bug debuginfod/27758] New: security idea: DEBUGINFOD_VERIFY mode fche at redhat dot com
  2021-04-20 18:18 ` [Bug debuginfod/27758] " zbyszek at in dot waw.pl
@ 2021-04-20 18:23 ` fche at redhat dot com
  2021-04-21  0:15 ` vt at altlinux dot org
                   ` (3 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: fche at redhat dot com @ 2021-04-20 18:23 UTC (permalink / raw)
  To: elfutils-devel

https://sourceware.org/bugzilla/show_bug.cgi?id=27758

--- Comment #2 from Frank Ch. Eigler <fche at redhat dot com> ---
Yeah.  It may comfort those who are worried about the integrity of their
previously downloaded cached files, but is not robust against local attacker
who currently has control over the filesystem or processes.

-- 
You are receiving this mail because:
You are on the CC list for the bug.

^ permalink raw reply	[flat|nested] 7+ messages in thread

* [Bug debuginfod/27758] security idea: DEBUGINFOD_VERIFY mode
  2021-04-20 15:22 [Bug debuginfod/27758] New: security idea: DEBUGINFOD_VERIFY mode fche at redhat dot com
  2021-04-20 18:18 ` [Bug debuginfod/27758] " zbyszek at in dot waw.pl
  2021-04-20 18:23 ` fche at redhat dot com
@ 2021-04-21  0:15 ` vt at altlinux dot org
  2021-04-21  9:35 ` fweimer at redhat dot com
                   ` (2 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: vt at altlinux dot org @ 2021-04-21  0:15 UTC (permalink / raw)
  To: elfutils-devel

https://sourceware.org/bugzilla/show_bug.cgi?id=27758

Vitaly Chikunov <vt at altlinux dot org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |vt at altlinux dot org

--- Comment #3 from Vitaly Chikunov <vt at altlinux dot org> ---
Instead of `X-Debuginfod-Hash` you can use `ETag` where you can put anything
including sha256 (can be prescribed in webapi description), then GET request
with `If-None-Match` + tag value (which is a hash) will return just 304 if the
hash is not changed. So HEAD request is not needed too.

https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/ETag
https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/If-None-Match

-- 
You are receiving this mail because:
You are on the CC list for the bug.

^ permalink raw reply	[flat|nested] 7+ messages in thread

* [Bug debuginfod/27758] security idea: DEBUGINFOD_VERIFY mode
  2021-04-20 15:22 [Bug debuginfod/27758] New: security idea: DEBUGINFOD_VERIFY mode fche at redhat dot com
                   ` (2 preceding siblings ...)
  2021-04-21  0:15 ` vt at altlinux dot org
@ 2021-04-21  9:35 ` fweimer at redhat dot com
  2021-04-21 14:09 ` fche at redhat dot com
  2021-05-20  2:13 ` fche at redhat dot com
  5 siblings, 0 replies; 7+ messages in thread
From: fweimer at redhat dot com @ 2021-04-21  9:35 UTC (permalink / raw)
  To: elfutils-devel

https://sourceware.org/bugzilla/show_bug.cgi?id=27758

Florian Weimer <fweimer at redhat dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |fweimer at redhat dot com

--- Comment #4 from Florian Weimer <fweimer at redhat dot com> ---
And it should be possible to use the Content-Length header to verify that the
data does not have an excessive size (something that is not possible with just
the hash itself).

-- 
You are receiving this mail because:
You are on the CC list for the bug.

^ permalink raw reply	[flat|nested] 7+ messages in thread

* [Bug debuginfod/27758] security idea: DEBUGINFOD_VERIFY mode
  2021-04-20 15:22 [Bug debuginfod/27758] New: security idea: DEBUGINFOD_VERIFY mode fche at redhat dot com
                   ` (3 preceding siblings ...)
  2021-04-21  9:35 ` fweimer at redhat dot com
@ 2021-04-21 14:09 ` fche at redhat dot com
  2021-05-20  2:13 ` fche at redhat dot com
  5 siblings, 0 replies; 7+ messages in thread
From: fche at redhat dot com @ 2021-04-21 14:09 UTC (permalink / raw)
  To: elfutils-devel

https://sourceware.org/bugzilla/show_bug.cgi?id=27758

--- Comment #5 from Frank Ch. Eigler <fche at redhat dot com> ---
(In reply to Vitaly Chikunov from comment #3)
> Instead of `X-Debuginfod-Hash` you can use `ETag` where you can put anything
> including sha256 (can be prescribed in webapi description), then GET request
> with `If-None-Match` + tag value (which is a hash) will return just 304 if
> the hash is not changed. So HEAD request is not needed too.

That's a good idea, except in the case of an older [current] debuginfod that
doesn't understand If-None-Match, and would just resend the entire content
every time.  But at least it's not a security problem, just a performance one.

-- 
You are receiving this mail because:
You are on the CC list for the bug.

^ permalink raw reply	[flat|nested] 7+ messages in thread

* [Bug debuginfod/27758] security idea: DEBUGINFOD_VERIFY mode
  2021-04-20 15:22 [Bug debuginfod/27758] New: security idea: DEBUGINFOD_VERIFY mode fche at redhat dot com
                   ` (4 preceding siblings ...)
  2021-04-21 14:09 ` fche at redhat dot com
@ 2021-05-20  2:13 ` fche at redhat dot com
  5 siblings, 0 replies; 7+ messages in thread
From: fche at redhat dot com @ 2021-05-20  2:13 UTC (permalink / raw)
  To: elfutils-devel

https://sourceware.org/bugzilla/show_bug.cgi?id=27758

Frank Ch. Eigler <fche at redhat dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
         Resolution|---                         |WONTFIX

--- Comment #6 from Frank Ch. Eigler <fche at redhat dot com> ---
putting idea on ice

-- 
You are receiving this mail because:
You are on the CC list for the bug.

^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2021-05-20  2:13 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-04-20 15:22 [Bug debuginfod/27758] New: security idea: DEBUGINFOD_VERIFY mode fche at redhat dot com
2021-04-20 18:18 ` [Bug debuginfod/27758] " zbyszek at in dot waw.pl
2021-04-20 18:23 ` fche at redhat dot com
2021-04-21  0:15 ` vt at altlinux dot org
2021-04-21  9:35 ` fweimer at redhat dot com
2021-04-21 14:09 ` fche at redhat dot com
2021-05-20  2:13 ` fche at redhat dot com

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).