Bug 1217402

Summary: AUDIT-FIND: Updating server configuration as root while parsing untrusted data
Product: [openSUSE] openSUSE Tumbleweed Reporter: Johannes Segitz <jsegitz>
Component: OtherAssignee: Michele Bussolotto <michele.bussolotto>
Status: NEW --- QA Contact: E-mail List <qa-bugs>
Severity: Normal    
Priority: P5 - None CC: fstrba
Version: Current   
Target Milestone: ---   
Hardware: Other   
OS: Other   
Whiteboard:
Found By: --- Services Priority:
Business Priority: Blocker: ---
Marketing QA Status: --- IT Deployment: ---

Description Johannes Segitz 2023-11-22 13:01:38 UTC
With the new tomcat10 packages I stumbled across:

687 %post webapps
688 %{serverxmltool} add-context.xslt docBase=%{tomcatappdir}/ROOT path=/
689 %{serverxmltool} add-context.xslt docBase=%{tomcatappdir}/sample path=/sample
690 %{serverxmltool} add-context.xslt docBase=%{tomcatappdir}/examples path=/examples

This translates to e.g.
/usr/libexec/tomcat/serverxml-tool.sh add-context.xslt docBase=/usr/share/tomcat/tomcat-webapps/ROOT path=/

serverxml-tool.sh invokes java with serverxmltool.jar to update /etc/tomcat/server.xml. All of this runs as root and parses XML. I didn't find a security issue with this (but also just spend a couple of minutes on this), but it's a bigger risk than necessary. Apart from overwriting the config file root privileges are not needed. Especially the java call should not run as root, xml operations are notoriously dangerous.

runuser is a good tool for this. You can do the XML parsing as the tomcat user and then if necessary overwrite the tomcat config with an update file.
Comment 1 OBSbugzilla Bot 2024-01-16 11:35:01 UTC
This is an autogenerated message for OBS integration:
This bug (1217402) was mentioned in
https://build.opensuse.org/request/show/1139112 Factory / tomcat10
https://build.opensuse.org/request/show/1139114 Factory / tomcat
Comment 6 Maintenance Automation 2024-02-14 16:36:22 UTC
SUSE-SU-2024:0472-1: An update that solves five vulnerabilities and has two security fixes can now be installed.

Category: security (important)
Bug References: 1216118, 1216119, 1216120, 1217402, 1217649, 1217768, 1219208
CVE References: CVE-2023-42794, CVE-2023-42795, CVE-2023-45648, CVE-2023-46589, CVE-2024-22029
Sources used:
openSUSE Leap 15.5 (src): tomcat-9.0.85-150200.57.1
Web and Scripting Module 15-SP5 (src): tomcat-9.0.85-150200.57.1
SUSE Linux Enterprise High Performance Computing 15 SP2 LTSS 15-SP2 (src): tomcat-9.0.85-150200.57.1
SUSE Linux Enterprise High Performance Computing LTSS 15 SP3 (src): tomcat-9.0.85-150200.57.1
SUSE Linux Enterprise High Performance Computing ESPOS 15 SP4 (src): tomcat-9.0.85-150200.57.1
SUSE Linux Enterprise High Performance Computing LTSS 15 SP4 (src): tomcat-9.0.85-150200.57.1
SUSE Linux Enterprise Server 15 SP2 LTSS 15-SP2 (src): tomcat-9.0.85-150200.57.1
SUSE Linux Enterprise Server 15 SP3 LTSS 15-SP3 (src): tomcat-9.0.85-150200.57.1
SUSE Linux Enterprise Server 15 SP4 LTSS 15-SP4 (src): tomcat-9.0.85-150200.57.1
SUSE Linux Enterprise Server for SAP Applications 15 SP2 (src): tomcat-9.0.85-150200.57.1
SUSE Linux Enterprise Server for SAP Applications 15 SP3 (src): tomcat-9.0.85-150200.57.1
SUSE Linux Enterprise Server for SAP Applications 15 SP4 (src): tomcat-9.0.85-150200.57.1
SUSE Manager Server 4.3 (src): tomcat-9.0.85-150200.57.1
SUSE Enterprise Storage 7.1 (src): tomcat-9.0.85-150200.57.1

NOTE: This line indicates an update has been released for the listed product(s). At times this might be only a partial fix. If you have questions please reach out to maintenance coordination.