Subject: CVS commit: pkgsrc/sysutils/py-borgbackup
From: Benny Siegert
Date: 2023-08-31 16:53:48
Message id: 20230831145348.764F4FBDB@cvs.NetBSD.org

Log Message:
py-borgbackup: update to 1.2.5 (security)

- Security: fix pre-1.2.5 archives spoofing vulnerability (CVE-2023-36811), see
  details and necessary upgrade procedure described below.
- create: do not try to read parent dir of recursion root
- extract: fix false warning about pattern never matching
- diff: remove surrogates before output
- compact: clear empty directories at end of compact process
- create --files-cache=size: fix crash
- keyfiles: improve key sanity check
- only warn about "invalid" chunker params
- ProgressIndicatorPercent: fix space computation for wide chars
- improve argparse validator error messages

New features:

- mount: make up volname if not given (macOS). macFUSE supports a volname mount
  option to give what finder displays on the desktop / in the directory view. if
  the user did not specify it, we make something up, because otherwise it would be
  "macFUSE Volume 0 (Python)" and hide the mountpoint directory name.
- BORG_WORKAROUNDS=authenticated_no_key to extract from authenticated repos
  without key

Pre-1.2.5 archives spoofing vulnerability (CVE-2023-36811)
----------------------------------------------------------

A flaw in the cryptographic authentication scheme in Borg allowed an attacker to
fake archives and potentially indirectly cause backup data loss in the repository.

The attack requires an attacker to be able to

1. insert files (with no additional headers) into backups
2. gain write access to the repository

This vulnerability does not disclose plaintext to the attacker, nor does it
affect the authenticity of existing archives.

Creating plausible fake archives may be feasible for empty or small archives,
but is unlikely for large archives.

The fix enforces checking the TAM authentication tag of archives at critical
places. Borg now considers archives without TAM as garbage or an attack.

We are not aware of others having discovered, disclosed or exploited this \ 
vulnerability.

Below, if we speak of borg 1.2.5, we mean a borg version >= 1.2.5 **or** a
borg version that has the relevant security patches for this vulnerability applied
(could be also an older version in that case).

Steps you must take to upgrade a repository:

1. Upgrade all clients using this repository to borg 1.2.5.
   Note: it is not required to upgrade a server, except if the server-side borg
   is also used as a client (and not just for "borg serve").

   Do **not** run ``borg check`` with borg 1.2.5 before completing the upgrade steps.

2. Run ``borg info --debug <repository> 2>&1 | grep TAM | grep -i \ 
manifest``.
   a) If you get "TAM-verified manifest", continue with 3.
   b) If you get "Manifest TAM not found and not required", run
      ``borg upgrade --tam --force <repository>`` *on every client*.

3. Run ``borg list --format='{name} {time} tam:{tam}{NL}' <repository>``.
   "tam:verified" means that the archive has a valid TAM authentication.
   "tam:none" is expected as output for archives created by borg <1.0.9.
   "tam:none" could also come from archives created by an attacker.
   You should verify that "tam:none" archives are authentic and not \ 
malicious
   (== have good content, have correct timestamp, can be extracted successfully).
   In case you find crappy/malicious archives, you must delete them before \ 
proceeding.
   In low-risk, trusted environments, you may decide on your own risk to skip step 3
   and just trust in everything being OK.

4. If there are no tam:non archives left at this point, you can skip this step.
   Run ``borg upgrade --archives-tam <repository>``.
   This will make sure all archives are TAM authenticated (an archive TAM will \ 
be added
   for all archives still missing one).
   ``borg check`` would consider TAM-less archives as garbage or a potential attack.
   Optionally run the same command as in step 3 to see that all archives now are \ 
"tam:verified".

Files:
RevisionActionfile
1.45modifypkgsrc/sysutils/py-borgbackup/Makefile
1.31modifypkgsrc/sysutils/py-borgbackup/distinfo