Lucene search

K
sambaSamba SecuritySAMBA:CVE-2013-4476
HistoryNov 11, 2013 - 12:00 a.m.

Private key in key.pem world readable

2013-11-1100:00:00
Samba Security
www.samba.org
534

0.001 Low

EPSS

Percentile

24.6%

Description

Due to incorrect directory and file permissions a local attacker might
obtain the private key that is used for the SSL/TLS encryption for
ldaps (including STARTTLS on ldap) and https network traffic.

The attacker is then able to decrypt encrypted network traffic which
may contain confidential information like passwords.

Note that the http(s) service is not started by default, only if the
β€œserver services” option contains β€œweb”.

The ldap(s) service is only started if Samba is configured as an
active directory domain controller.

$ samba-tool testparm -v --suppress-prompt | grep β€˜server role’
server role = active directory domain controller

$ samba-tool testparm -v --suppress-prompt | grep β€˜server service’
server services = s3fs, rpc, nbt, wrepl, ldap, cldap, kdc, drepl, winbind, ntp_signd, kcc, dnsupdate, dns

$ samba-tool testparm -v --suppress-prompt | grep tls
tls enabled = Yes
tls keyfile = tls/key.pem
tls certfile = tls/cert.pem
tls cafile = tls/ca.pem
tls crlfile =
tls dh params file =
$ samba-tool testparm -v --suppress-prompt | grep β€˜private dir’
private dir = /var/lib/samba/private

The full path to the keyfile is ${private_dir}/${tls_keyfile},
e.g. /var/lib/samba/private/tls/key.pem.

The tls certificates are autogenerated and selfsigned on the first
start of β€˜samba’. With the unpatched Samba versions the permissions
typically look like this:

$ ls -lad /var/lib/samba
drwxr-xr-x 7 root root 4096 Feb 13 2013 /var/lib/samba

$ ls -lad /var/lib/samba/private
drwxr-xr-x 6 root root 4096 Sep 24 04:00 /var/lib/samba/private

$ ls -la /var/lib/samba/private/tls/
total 20
drwxr-xr-x 2 root root 4096 Feb 5 2013 .
drwxr-xr-x 6 root root 4096 Sep 24 04:00 …
-rw-r–r-- 1 root root 985 Feb 5 2013 ca.pem
-rw-r–r-- 1 root root 985 Feb 5 2013 cert.pem
-rw-r–r-- 1 root root 883 Feb 5 2013 key.pem

Note: Your vendor/packager might have installed the private directory
with more restrictive permissions (0750 or 700).

In all cases you should change the permissions of the β€˜tls’ directory
to 0700.

You should remove ca.pem, cert.pem and key.pem and let a (re)start of
β€˜samba’ take care of autogenerating a new set of files, if you are not
100% certain that key.pem was protected all the time by parent
directory permissions.

If you can be 100% certain that key.pem has never been exposed for
unauthorized access, you may just change its permission to 0600, if
you really have a good reason to keep the existing keys.

Note: A patched version of Samba will refuse to start if the
permissions of key.pem are not 0600.

Workaround

Follow the instructions for autoregenerating the related files above
and change the permissions of key.pem to 0600 yourself.

Patch Availability

A patch addressing this defect has been posted to

http://www.samba.org/samba/security/

Additionally, Samba 4.0.11 and 4.1.1 have been issued as security
releases to correct the defect. Samba vendors and administrators
running affected versions are advised to upgrade or apply the patch as
soon as possible or manually apply the workaround.

In the fixed version, samba refuses to start if the permissions of
/var/lib/samba/private/tls/key.pem are not 0600.

Credits

This problem was found by an internal audit of the Samba code by
Stefan Metzmacher and BjΓΆrn Baumbach of SerNet.

Patches provided by BjΓΆrn Baumbach of SerNet.

0.001 Low

EPSS

Percentile

24.6%