<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: Security issue?! Splunk UF v9.x is re-adding readall capability in Installation</title>
    <link>https://community.splunk.com/t5/Installation/Security-issue-Splunk-UF-v9-x-is-re-adding-readall-capability/m-p/649049#M13044</link>
    <description>&lt;P&gt;well, good catch&amp;nbsp;&lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/194518"&gt;@schose&lt;/a&gt;&amp;nbsp;!&amp;nbsp;&lt;/P&gt;&lt;P&gt;nice learning, sir!&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Tue, 04 Jul 2023 02:07:56 GMT</pubDate>
    <dc:creator>inventsekar</dc:creator>
    <dc:date>2023-07-04T02:07:56Z</dc:date>
    <item>
      <title>Security issue?! Splunk UF v9.x is re-adding readall capability</title>
      <link>https://community.splunk.com/t5/Installation/Security-issue-Splunk-UF-v9-x-is-re-adding-readall-capability/m-p/649047#M13043</link>
      <description>&lt;P&gt;Hi all,&lt;/P&gt;&lt;P&gt;Splunk UF since 9.x is setting&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;[Service]
NoNewPrivileges=yes
AmbientCapabilities=CAP_DAC_READ_SEARCH&lt;/PRE&gt;&lt;P&gt;in systemd unit file (/etc/systemd/system/SplunkForwarder.service). This enables splunkforwarder to bypass Filesystems permissions and acls and read every file on harddisk - yes, every file: every ssh key, every private key, confidential data.. the&amp;nbsp;&lt;SPAN&gt;opposite of the "least-to-know" principle.&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;As we have correct filesystem permissions in place we decided to remove those settings from systemd unit file. When we now run e.g.: "/opt/splunkforwarder/bin/splunk stop" command the systemd file is rewritten by the splunk command. This will start splunkforwarder with enabled&amp;nbsp;CAP_DAC_READ_SEARCH capability.&lt;/P&gt;&lt;P&gt;To make is more visual we uploaded a video to&amp;nbsp;&lt;A href="https://asciinema.org/a/FAYFPJYrKaizfL3alzvm3uNGF" target="_self"&gt;https://asciinema.org/a/FAYFPJYrKaizfL3alzvm3uNGF .&amp;nbsp;&lt;/A&gt;&lt;/P&gt;&lt;P&gt;Are you able to reproduce the issue? What do you think?&lt;/P&gt;&lt;P&gt;For us this looks like a secuity issue, as we would never expect a command like "splunk stop" manipulate systemd files. I'm also not aware which other command might rewrite the systemd unit. I also do not seed any usecase for this.&amp;nbsp;&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;&lt;P&gt;steps to reproduce:&lt;BR /&gt;install-splunkuf.sh&lt;/P&gt;&lt;PRE&gt;#!/bin/bash

# break if errors
set -e

# add system user
sudo groupadd splunk
sudo useradd splunk --system --home-dir /opt/splunk --create-home -g splunk

wget -O /tmp/splunkuf.tgz https://download.splunk.com/products/universalforwarder/releases/9.1.0/linux/splunkforwarder-9.1.0-1c86ca0bacc3-Linux-x86_64.tgz
#wget -O /tmp/splunkuf.tgz https://download.splunk.com/products/universalforwarder/releases/9.0.5/linux/splunkforwarder-9.0.5-e9494146ae5c-Linux-armv8.tgz

tar zxfv /tmp/splunkuf.tgz -C /opt
echo -e "[user_info]\nUSERNAME=admin\nPASSWORD=Password01" &amp;gt; /opt/splunkforwarder/etc/system/local/user-seed.conf
/opt/splunkforwarder/bin/splunk start --accept-license &amp;amp;&amp;amp; /opt/splunkforwarder/bin/splunk stop -f
/opt/splunkforwarder/bin/splunk enable boot-start -user splunk -group splunk -systemd-managed 1

# remove capabilities from systemd service
sed -i '/^NoNewPrivileges\|^AmbientCapabilities/s/^/#/' /etc/systemd/system/SplunkForwarder.service
systemctl daemon-reload

systemctl start SplunkForwarder
systemctl status SplunkForwarder

# systemd file is still fine
echo -n "systemd unit file after starting splunk"
cat /etc/systemd/system/SplunkForwarder.service

pid=$(systemctl show -p MainPID --value SplunkForwarder.service) &amp;amp;&amp;amp; getpcaps $pid&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;when you now run&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;/opt/splunkforwarder/bin/splunk stop
cat /etc/systemd/system/SplunkForwarder.service&lt;/PRE&gt;&lt;P&gt;you see that lines&lt;/P&gt;&lt;PRE&gt;NoNewPrivileges=yes
AmbientCapabilities=CAP_DAC_READ_SEARCH&lt;/PRE&gt;&lt;P&gt;are re-added to&amp;nbsp;/etc/systemd/system/SplunkForwarder.service and next time the service is started caps are set. A backup file is also placed&amp;nbsp;/etc/systemd/system/SplunkForwarder.service_TIMESTAMP.&lt;/P&gt;&lt;P&gt;when running a strace&lt;/P&gt;&lt;PRE&gt;strace -s 0 -o /tmp/910stop.strace -f /opt/splunkforwarder/bin/splunk stop&lt;/PRE&gt;&lt;P&gt;we clearly see the splunk process manipulating the systemd file.&lt;/P&gt;&lt;PRE&gt;2120 rename("/etc/systemd/system/SplunkForwarder.service", "/etc/systemd/system/SplunkForwarder.service_2023_07_03_21_47_00") = 0
2120 clone(child_stack=NULL, flags=CLONE_CHILD_CLEARTID|CLONE_CHILD_SETTID|SIGCHLD, child_tidptr=0x7feb05354f10) = 2122
2120 wait4(2122, 
2122 set_robust_list(0x7feb05354f20, 24) = 0&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;This happens on all 9.x versions of UF.&amp;nbsp;&lt;/P&gt;&lt;P&gt;best regards,&lt;/P&gt;&lt;P&gt;Andreas&lt;/P&gt;</description>
      <pubDate>Mon, 03 Jul 2023 21:51:23 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Installation/Security-issue-Splunk-UF-v9-x-is-re-adding-readall-capability/m-p/649047#M13043</guid>
      <dc:creator>schose</dc:creator>
      <dc:date>2023-07-03T21:51:23Z</dc:date>
    </item>
    <item>
      <title>Re: Security issue?! Splunk UF v9.x is re-adding readall capability</title>
      <link>https://community.splunk.com/t5/Installation/Security-issue-Splunk-UF-v9-x-is-re-adding-readall-capability/m-p/649049#M13044</link>
      <description>&lt;P&gt;well, good catch&amp;nbsp;&lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/194518"&gt;@schose&lt;/a&gt;&amp;nbsp;!&amp;nbsp;&lt;/P&gt;&lt;P&gt;nice learning, sir!&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 04 Jul 2023 02:07:56 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Installation/Security-issue-Splunk-UF-v9-x-is-re-adding-readall-capability/m-p/649049#M13044</guid>
      <dc:creator>inventsekar</dc:creator>
      <dc:date>2023-07-04T02:07:56Z</dc:date>
    </item>
    <item>
      <title>Re: Security issue?! Splunk UF v9.x is re-adding readall capability</title>
      <link>https://community.splunk.com/t5/Installation/Security-issue-Splunk-UF-v9-x-is-re-adding-readall-capability/m-p/652236#M13109</link>
      <description>&lt;P&gt;Hi all,&lt;/P&gt;&lt;P&gt;To ensure that CAP_DAC_READ_SEARCH is not set, systemd overwrite mechanism could be used.&lt;/P&gt;&lt;P&gt;create&amp;nbsp;/etc/systemd/system/SplunkForwarder.service.d/override.conf with content:&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;[Service]
NoNewPrivileges=yes
AmbientCapabilities=&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;this ensures, that even if /etc/systemd/system/SplunkForwarder.service is rewritten - which still looks like an issue to me - the&amp;nbsp;AmbientCapabilities are still empty.&amp;nbsp;&lt;/P&gt;&lt;P&gt;Best regards,&lt;/P&gt;&lt;P&gt;Andreas&lt;/P&gt;</description>
      <pubDate>Thu, 27 Jul 2023 15:22:03 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Installation/Security-issue-Splunk-UF-v9-x-is-re-adding-readall-capability/m-p/652236#M13109</guid>
      <dc:creator>schose</dc:creator>
      <dc:date>2023-07-27T15:22:03Z</dc:date>
    </item>
  </channel>
</rss>

