It explains, that the `--ledir` option of mysqld_safe MUST NOT be accepted from config file, as an attacker with permission to edit at least some config files can re-define it to run malicious custom version of the server from a custom location.
So it seems like a security regression in the upstream code of MariaDB.
The mysqld_safe is meant to be used on distros without Systemd:
mysqld_safe is the recommended way to start mysqld on Linux and Unix distributions that do not support systemd. Additionally, the mysql.server init script used by sysVinit starts mysqld with mysqld_safe by default.
That IMO greatly reduces the area of attack, as the server admin had to configure custom systemd service file that would be used for starting the DB, so it would use the mysqld_safe.
I'm not sure how to regression came to be.
It doesn't seem to be intended, as the it was not reverted. It was just never applied in MariaDB 10.2, as far as I can tell.
However since we (upstream, Fedora, CentOS Stream, RHEL) all still ship the mysqld_safe (or mariadb-safe), I'd like to clarify, whether it is an overlooked regression, or whether the base ground for this CVE does not exists to begin with in MariaDB 10.2 and later.
The fix in MariaDB commit 8fcdd6b0ec rejects --ledir if it comes from my.cnf in the datadir (indeed, because the server has write access to the datadir, so it can modify its own settings there). This fix disappeared in the commit Merge branch '10.1' into 10.2. Part of the merge's diff is
then
log_error "WARNING: Found $DATADIR/my.cnf
-The data directory is a deprecated location for my.cnf, please move it to
+The data directory is not a valid location for my.cnf, please move it to
$MY_BASEDIR_VERSION/my.cnf"
- unsafe_my_cnf=1
- MYSQL_HOME=$DATADIR
- else
- MYSQL_HOME=$MY_BASEDIR_VERSION
fi
+ MYSQL_HOME=$MY_BASEDIR_VERSION
fi
that is, since 10.2 the server no longer reads my.cnf from the datadir at all. Thus a special protection check for that particular case is no longer needed.
Sergei Golubchik
added a comment - The fix in MariaDB commit 8fcdd6b0ec rejects --ledir if it comes from my.cnf in the datadir (indeed, because the server has write access to the datadir, so it can modify its own settings there). This fix disappeared in the commit Merge branch '10.1' into 10.2 . Part of the merge's diff is
then
log_error "WARNING: Found $DATADIR/my.cnf
-The data directory is a deprecated location for my.cnf, please move it to
+The data directory is not a valid location for my.cnf, please move it to
$MY_BASEDIR_VERSION/my.cnf"
- unsafe_my_cnf=1
- MYSQL_HOME=$DATADIR
- else
- MYSQL_HOME=$MY_BASEDIR_VERSION
fi
+ MYSQL_HOME=$MY_BASEDIR_VERSION
fi
that is, since 10.2 the server no longer reads my.cnf from the datadir at all. Thus a special protection check for that particular case is no longer needed.
People
Sergei Golubchik
Michal Schorm
Votes:
0Vote for this issue
Watchers:
2Start watching this issue
Dates
Created:
Updated:
Resolved:
Git Integration
Error rendering 'com.xiplink.jira.git.jira_git_plugin:git-issue-webpanel'. Please contact your Jira administrators.
{"report":{"fcp":1157,"ttfb":305,"pageVisibility":"visible","entityId":126141,"key":"jira.project.issue.view-issue","isInitial":true,"threshold":1000,"elementTimings":{},"userDeviceMemory":8,"userDeviceProcessors":32,"apdex":0.5,"journeyId":"1f310257-f10c-4e1a-8d07-bfefbb978b8e","navigationType":0,"readyForUser":1279.6000003814697,"redirectCount":0,"resourceLoadedEnd":877.1000003814697,"resourceLoadedStart":310.2000002861023,"resourceTiming":[{"duration":194.90000009536743,"initiatorType":"link","name":"https://jira.mariadb.org/s/2c21342762a6a02add1c328bed317ffd-CDN/lu2cib/820016/12ta74/0a8bac35585be7fc6c9cc5a0464cd4cf/_/download/contextbatch/css/_super/batch.css","startTime":310.2000002861023,"connectEnd":0,"connectStart":0,"domainLookupEnd":0,"domainLookupStart":0,"fetchStart":310.2000002861023,"redirectEnd":0,"redirectStart":0,"requestStart":0,"responseEnd":505.1000003814697,"responseStart":0,"secureConnectionStart":0},{"duration":194.90000009536743,"initiatorType":"link","name":"https://jira.mariadb.org/s/7ebd35e77e471bc30ff0eba799ebc151-CDN/lu2cib/820016/12ta74/494e4c556ecbb29f90a3d3b4f09cb99c/_/download/contextbatch/css/jira.browse.project,project.issue.navigator,jira.view.issue,jira.general,jira.global,atl.general,-_super/batch.css?agile_global_admin_condition=true&jag=true&jira.create.linked.issue=true&slack-enabled=true&whisper-enabled=true","startTime":310.5,"connectEnd":0,"connectStart":0,"domainLookupEnd":0,"domainLookupStart":0,"fetchStart":310.5,"redirectEnd":0,"redirectStart":0,"requestStart":0,"responseEnd":505.40000009536743,"responseStart":0,"secureConnectionStart":0},{"duration":417.69999980926514,"initiatorType":"script","name":"https://jira.mariadb.org/s/0917945aaa57108d00c5076fea35e069-CDN/lu2cib/820016/12ta74/0a8bac35585be7fc6c9cc5a0464cd4cf/_/download/contextbatch/js/_super/batch.js?locale=en","startTime":310.6000003814697,"connectEnd":505.40000009536743,"connectStart":505.40000009536743,"domainLookupEnd":505.40000009536743,"domainLookupStart":505.40000009536743,"fetchStart":310.6000003814697,"redirectEnd":0,"redirectStart":0,"requestStart":507.90000009536743,"responseEnd":728.3000001907349,"responseStart":523.8000001907349,"secureConnectionStart":505.40000009536743},{"duration":566.4000000953674,"initiatorType":"script","name":"https://jira.mariadb.org/s/2d8175ec2fa4c816e8023260bd8c1786-CDN/lu2cib/820016/12ta74/494e4c556ecbb29f90a3d3b4f09cb99c/_/download/contextbatch/js/jira.browse.project,project.issue.navigator,jira.view.issue,jira.general,jira.global,atl.general,-_super/batch.js?agile_global_admin_condition=true&jag=true&jira.create.linked.issue=true&locale=en&slack-enabled=true&whisper-enabled=true","startTime":310.7000002861023,"connectEnd":310.7000002861023,"connectStart":310.7000002861023,"domainLookupEnd":310.7000002861023,"domainLookupStart":310.7000002861023,"fetchStart":310.7000002861023,"redirectEnd":0,"redirectStart":0,"requestStart":509.2000002861023,"responseEnd":877.1000003814697,"responseStart":532.6000003814697,"secureConnectionStart":310.7000002861023},{"duration":238.2000002861023,"initiatorType":"script","name":"https://jira.mariadb.org/s/a9324d6758d385eb45c462685ad88f1d-CDN/lu2cib/820016/12ta74/c92c0caa9a024ae85b0ebdbed7fb4bd7/_/download/contextbatch/js/atl.global,-_super/batch.js?locale=en","startTime":310.90000009536743,"connectEnd":310.90000009536743,"connectStart":310.90000009536743,"domainLookupEnd":310.90000009536743,"domainLookupStart":310.90000009536743,"fetchStart":310.90000009536743,"redirectEnd":0,"redirectStart":0,"requestStart":509.6000003814697,"responseEnd":549.1000003814697,"responseStart":543.5,"secureConnectionStart":310.90000009536743},{"duration":223.2999997138977,"initiatorType":"script","name":"https://jira.mariadb.org/s/d41d8cd98f00b204e9800998ecf8427e-CDN/lu2cib/820016/12ta74/1.0/_/download/batch/jira.webresources:calendar-en/jira.webresources:calendar-en.js","startTime":311.1000003814697,"connectEnd":311.1000003814697,"connectStart":311.1000003814697,"domainLookupEnd":311.1000003814697,"domainLookupStart":311.1000003814697,"fetchStart":311.1000003814697,"redirectEnd":0,"redirectStart":0,"requestStart":510.30000019073486,"responseEnd":534.4000000953674,"responseStart":528.2000002861023,"secureConnectionStart":311.1000003814697},{"duration":238.59999990463257,"initiatorType":"script","name":"https://jira.mariadb.org/s/d41d8cd98f00b204e9800998ecf8427e-CDN/lu2cib/820016/12ta74/1.0/_/download/batch/jira.webresources:calendar-localisation-moment/jira.webresources:calendar-localisation-moment.js","startTime":311.30000019073486,"connectEnd":311.30000019073486,"connectStart":311.30000019073486,"domainLookupEnd":311.30000019073486,"domainLookupStart":311.30000019073486,"fetchStart":311.30000019073486,"redirectEnd":0,"redirectStart":0,"requestStart":510.7000002861023,"responseEnd":549.9000000953674,"responseStart":544.4000000953674,"secureConnectionStart":311.30000019073486},{"duration":196.90000009536743,"initiatorType":"link","name":"https://jira.mariadb.org/s/b04b06a02d1959df322d9cded3aeecc1-CDN/lu2cib/820016/12ta74/a2ff6aa845ffc9a1d22fe23d9ee791fc/_/download/contextbatch/css/jira.global.look-and-feel,-_super/batch.css","startTime":311.40000009536743,"connectEnd":0,"connectStart":0,"domainLookupEnd":0,"domainLookupStart":0,"fetchStart":311.40000009536743,"redirectEnd":0,"redirectStart":0,"requestStart":0,"responseEnd":508.30000019073486,"responseStart":0,"secureConnectionStart":0},{"duration":231.59999990463257,"initiatorType":"script","name":"https://jira.mariadb.org/rest/api/1.0/shortcuts/820016/47140b6e0a9bc2e4913da06536125810/shortcuts.js?context=issuenavigation&context=issueaction","startTime":318.40000009536743,"connectEnd":318.40000009536743,"connectStart":318.40000009536743,"domainLookupEnd":318.40000009536743,"domainLookupStart":318.40000009536743,"fetchStart":318.40000009536743,"redirectEnd":0,"redirectStart":0,"requestStart":510.90000009536743,"responseEnd":550,"responseStart":545.5,"secureConnectionStart":318.40000009536743},{"duration":189.39999961853027,"initiatorType":"link","name":"https://jira.mariadb.org/s/3ac36323ba5e4eb0af2aa7ac7211b4bb-CDN/lu2cib/820016/12ta74/d176f0986478cc64f24226b3d20c140d/_/download/contextbatch/css/com.atlassian.jira.projects.sidebar.init,-_super,-project.issue.navigator,-jira.view.issue/batch.css?jira.create.linked.issue=true","startTime":319.1000003814697,"connectEnd":0,"connectStart":0,"domainLookupEnd":0,"domainLookupStart":0,"fetchStart":319.1000003814697,"redirectEnd":0,"redirectStart":0,"requestStart":0,"responseEnd":508.5,"responseStart":0,"secureConnectionStart":0},{"duration":234,"initiatorType":"script","name":"https://jira.mariadb.org/s/5d5e8fe91fbc506585e83ea3b62ccc4b-CDN/lu2cib/820016/12ta74/d176f0986478cc64f24226b3d20c140d/_/download/contextbatch/js/com.atlassian.jira.projects.sidebar.init,-_super,-project.issue.navigator,-jira.view.issue/batch.js?jira.create.linked.issue=true&locale=en","startTime":319.40000009536743,"connectEnd":319.40000009536743,"connectStart":319.40000009536743,"domainLookupEnd":319.40000009536743,"domainLookupStart":319.40000009536743,"fetchStart":319.40000009536743,"redirectEnd":0,"redirectStart":0,"requestStart":520.5,"responseEnd":553.4000000953674,"responseStart":551.9000000953674,"secureConnectionStart":319.40000009536743},{"duration":524.0999999046326,"initiatorType":"script","name":"https://jira.mariadb.org/s/d41d8cd98f00b204e9800998ecf8427e-CDN/lu2cib/820016/12ta74/1.0/_/download/batch/jira.webresources:bigpipe-js/jira.webresources:bigpipe-js.js","startTime":320.2000002861023,"connectEnd":320.2000002861023,"connectStart":320.2000002861023,"domainLookupEnd":320.2000002861023,"domainLookupStart":320.2000002861023,"fetchStart":320.2000002861023,"redirectEnd":0,"redirectStart":0,"requestStart":690.3000001907349,"responseEnd":844.3000001907349,"responseStart":839.3000001907349,"secureConnectionStart":320.2000002861023},{"duration":524.3000001907349,"initiatorType":"script","name":"https://jira.mariadb.org/s/d41d8cd98f00b204e9800998ecf8427e-CDN/lu2cib/820016/12ta74/1.0/_/download/batch/jira.webresources:bigpipe-init/jira.webresources:bigpipe-init.js","startTime":320.30000019073486,"connectEnd":320.30000019073486,"connectStart":320.30000019073486,"domainLookupEnd":320.30000019073486,"domainLookupStart":320.30000019073486,"fetchStart":320.30000019073486,"redirectEnd":0,"redirectStart":0,"requestStart":690.4000000953674,"responseEnd":844.6000003814697,"responseStart":839.9000000953674,"secureConnectionStart":320.30000019073486},{"duration":91.30000019073486,"initiatorType":"xmlhttprequest","name":"https://jira.mariadb.org/rest/webResources/1.0/resources","startTime":878.9000000953674,"connectEnd":878.9000000953674,"connectStart":878.9000000953674,"domainLookupEnd":878.9000000953674,"domainLookupStart":878.9000000953674,"fetchStart":878.9000000953674,"redirectEnd":0,"redirectStart":0,"requestStart":936.9000000953674,"responseEnd":970.2000002861023,"responseStart":969.4000000953674,"secureConnectionStart":878.9000000953674},{"duration":137.09999990463257,"initiatorType":"xmlhttprequest","name":"https://jira.mariadb.org/rest/webResources/1.0/resources","startTime":1110.3000001907349,"connectEnd":1110.3000001907349,"connectStart":1110.3000001907349,"domainLookupEnd":1110.3000001907349,"domainLookupStart":1110.3000001907349,"fetchStart":1110.3000001907349,"redirectEnd":0,"redirectStart":0,"requestStart":1213.4000000953674,"responseEnd":1247.4000000953674,"responseStart":1246.6000003814697,"secureConnectionStart":1110.3000001907349},{"duration":197.7999997138977,"initiatorType":"script","name":"https://www.google-analytics.com/analytics.js","startTime":1150.2000002861023,"connectEnd":0,"connectStart":0,"domainLookupEnd":0,"domainLookupStart":0,"fetchStart":1150.2000002861023,"redirectEnd":0,"redirectStart":0,"requestStart":0,"responseEnd":1348,"responseStart":0,"secureConnectionStart":0}],"fetchStart":0,"domainLookupStart":0,"domainLookupEnd":0,"connectStart":0,"connectEnd":0,"requestStart":139,"responseStart":305,"responseEnd":318,"domLoading":309,"domInteractive":1361,"domContentLoadedEventStart":1361,"domContentLoadedEventEnd":1439,"domComplete":1875,"loadEventStart":1875,"loadEventEnd":1876,"userAgent":"Mozilla/5.0 AppleWebKit/537.36 (KHTML, like Gecko; compatible; ClaudeBot/1.0; +claudebot@anthropic.com)","marks":[{"name":"bigPipe.sidebar-id.start","time":1333},{"name":"bigPipe.sidebar-id.end","time":1333.8000001907349},{"name":"bigPipe.activity-panel-pipe-id.start","time":1334},{"name":"bigPipe.activity-panel-pipe-id.end","time":1335.4000000953674},{"name":"activityTabFullyLoaded","time":1450.2000002861023}],"measures":[],"correlationId":"6b721f7d069a40","effectiveType":"4g","downlink":10,"rtt":0,"serverDuration":95,"dbReadsTimeInMs":9,"dbConnsTimeInMs":23,"applicationHash":"9d11dbea5f4be3d4cc21f03a88dd11d8c8687422","experiments":[]}}
The fix in MariaDB commit 8fcdd6b0ec rejects --ledir if it comes from my.cnf in the datadir (indeed, because the server has write access to the datadir, so it can modify its own settings there). This fix disappeared in the commit Merge branch '10.1' into 10.2. Part of the merge's diff is
then
log_error "WARNING: Found $DATADIR/my.cnf
-The data directory is a deprecated location for my.cnf, please move it to
+The data directory is not a valid location for my.cnf, please move it to
$MY_BASEDIR_VERSION/my.cnf"
- unsafe_my_cnf=1
- MYSQL_HOME=$DATADIR
- else
- MYSQL_HOME=$MY_BASEDIR_VERSION
fi
+ MYSQL_HOME=$MY_BASEDIR_VERSION
that is, since 10.2 the server no longer reads my.cnf from the datadir at all. Thus a special protection check for that particular case is no longer needed.