Linux drag0nius.pl 3.8.7-1-ARCH #1 SMP PREEMPT Sat Apr 13 09:01:47 CEST 2013 x86_64 GNU/Linux
Description
Passwords in "mysql_secure_installation" script are read without "-r" modifier meaning that backlashes passed into it by user are treated as escape character instead of real backslash (what in my opinion is desired)
Example:
1. Pass 1\23 as new root password in mysql_secure_installation script
2. mysql -u root -p does not accept 1\23 password, but it accepts "123" instead,
3. mysql_secure_installation accepts both 1\23 and 123
Fix 1 (recommended):
/usr/bin/mysql_secure_installation:
line
current
replacement
245
read password
read -r password
265
read password1
read -r password1
268
read password2
read -r password2
Fix 2:
Another way would be informing user that backslash is treated as escape symbol and that you need to pass double backslash.
Patching process:
1. Open the file with VIM
2. Write ":%s/read pass/read -r pass/g", press Enter
Patched "1\23"
root
localhost
*4D617476C30310C15DB73E333FA5CC4E555B3BDA
Unpached "1 23":
root
localhost
*4D617476C30310C15DB73E333FA5CC4E555B3BDA
Unpached "1\23"
root
localhost
*23AE809DDACAF96AF0FD78ED04B6A265E05AA257
Patched "123"
root
localhost
*23AE809DDACAF96AF0FD78ED04B6A265E05AA257
Unpatched "123"
root
localhost
*23AE809DDACAF96AF0FD78ED04B6A265E05AA257
Patched "1\2\3\"
root
localhost
*9FB0E6F84609F74C3EAB1A26C41953DE1D133889
Unpached "1\\2\\3 "
root
localhost
*9FB0E6F84609F74C3EAB1A26C41953DE1D133889
Unpached "1\2\3\"
root
localhost
*23AE809DDACAF96AF0FD78ED04B6A265E05AA257
You can clearly see that all variants of single-backslash passwords passed to installation script become "123" after the script is done.
On my computer it works the way it should and i get results i expect both in patched and unpatched version.
To be honest i have no idea where did you get that from, i suggest checking it again:
root
*6CE27BDC6F768BB235AA78F24453062FAEEC9A6F
Try typing "1\2\3" in the first prompt, then "123" in retyping, the script will pass through setting "123" password.
Krzysztof Nazarewski
added a comment - - edited Patching process:
1. Open the file with VIM
2. Write ":%s/read pass/read -r pass/g", press Enter
Patched "1\23"
root
localhost
*4D617476C30310C15DB73E333FA5CC4E555B3BDA
Unpached "1 23":
root
localhost
*4D617476C30310C15DB73E333FA5CC4E555B3BDA
Unpached "1\23"
root
localhost
*23AE809DDACAF96AF0FD78ED04B6A265E05AA257
Patched "123"
root
localhost
*23AE809DDACAF96AF0FD78ED04B6A265E05AA257
Unpatched "123"
root
localhost
*23AE809DDACAF96AF0FD78ED04B6A265E05AA257
Patched "1\2\3\"
root
localhost
*9FB0E6F84609F74C3EAB1A26C41953DE1D133889
Unpached "1\\2\\3 "
root
localhost
*9FB0E6F84609F74C3EAB1A26C41953DE1D133889
Unpached "1\2\3\"
root
localhost
*23AE809DDACAF96AF0FD78ED04B6A265E05AA257
You can clearly see that all variants of single-backslash passwords passed to installation script become "123" after the script is done.
On my computer it works the way it should and i get results i expect both in patched and unpatched version.
To be honest i have no idea where did you get that from, i suggest checking it again:
root
*6CE27BDC6F768BB235AA78F24453062FAEEC9A6F
Try typing "1\2\3" in the first prompt, then "123" in retyping, the script will pass through setting "123" password.
I figured it out, it seems to be caused by an old bug in dash https://bugs.launchpad.net/ubuntu/+source/dash/+bug/259671 (which is ubuntu's sh, which is used by mysql_secure_installation). At some point mysql_secure_installation uses echo to escape the password line, and that's where the bug shows up.
elenst@ubuntu12-04:/data$ ls -l /bin/sh
lrwxrwxrwx 1 root root 4 Jan 24 16:29 /bin/sh -> dash
Hence it's indeed a glitch of my system, yours works reasonably.
So, as said before, I recommend to file a bug report at bugs.mysql.com, as soon as they make a change it will be incorporated to the corresponding version of MariaDB.
Upd: I see you've already done it, MySQL:69044.
Elena Stepanova
added a comment - - edited I figured it out, it seems to be caused by an old bug in dash https://bugs.launchpad.net/ubuntu/+source/dash/+bug/259671 (which is ubuntu's sh, which is used by mysql_secure_installation). At some point mysql_secure_installation uses echo to escape the password line, and that's where the bug shows up.
elenst@ubuntu12-04:/data$ ls -l /bin/sh
lrwxrwxrwx 1 root root 4 Jan 24 16:29 /bin/sh -> dash
elenst@ubuntu12-04:/data$ /bin/sh
$ read -r p
1\23
$ echo $p
1�Ё
$ exit
elenst@ubuntu12-04:/data$ echo $SHELL
/bin/bash
elenst@ubuntu12-04:/data$ read -r p
1\23
elenst@ubuntu12-04:/data$ echo $p
1\23
Hence it's indeed a glitch of my system, yours works reasonably.
So, as said before, I recommend to file a bug report at bugs.mysql.com, as soon as they make a change it will be incorporated to the corresponding version of MariaDB.
Upd: I see you've already done it, MySQL:69044.
Seems dash bug was ruled invalid. MySQL have a fix - migrating to a C++ version client/mysql_secure_installation.cc
alternately could #!/bin/bash at top.
Daniel Black
added a comment - Seems dash bug was ruled invalid. MySQL have a fix - migrating to a C++ version client/mysql_secure_installation.cc
alternately could #!/bin/bash at top.
Daniel Black
added a comment - There are other aspects of escaping that are also problematic in the script. Docker library fixes these with bash specific constructs - https://github.com/MariaDB/mariadb-docker/commit/58f4020613e4b96ab0a937890af1a7a4e0dc4b00 .
People
Unassigned
Krzysztof Nazarewski
Votes:
0Vote for this issue
Watchers:
5Start watching this issue
Dates
Created:
Updated:
Git Integration
Error rendering 'com.xiplink.jira.git.jira_git_plugin:git-issue-webpanel'. Please contact your Jira administrators.
{"report":{"fcp":1425.5,"ttfb":278.7000000476837,"pageVisibility":"visible","entityId":23916,"key":"jira.project.issue.view-issue","isInitial":true,"threshold":1000,"elementTimings":{},"userDeviceMemory":8,"userDeviceProcessors":64,"apdex":0.5,"journeyId":"ba264cbc-cd0a-4659-9e12-d5c3f029e37c","navigationType":0,"readyForUser":1512.2000000476837,"redirectCount":0,"resourceLoadedEnd":1160.2000000476837,"resourceLoadedStart":304.10000014305115,"resourceTiming":[{"duration":17.399999856948853,"initiatorType":"link","name":"https://jira.mariadb.org/s/2c21342762a6a02add1c328bed317ffd-CDN/lu2cib/820016/12ta74/0a8bac35585be7fc6c9cc5a0464cd4cf/_/download/contextbatch/css/_super/batch.css","startTime":304.10000014305115,"connectEnd":0,"connectStart":0,"domainLookupEnd":0,"domainLookupStart":0,"fetchStart":304.10000014305115,"redirectEnd":0,"redirectStart":0,"requestStart":0,"responseEnd":321.5,"responseStart":0,"secureConnectionStart":0},{"duration":20.299999952316284,"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":304.40000009536743,"connectEnd":0,"connectStart":0,"domainLookupEnd":0,"domainLookupStart":0,"fetchStart":304.40000009536743,"redirectEnd":0,"redirectStart":0,"requestStart":0,"responseEnd":324.7000000476837,"responseStart":0,"secureConnectionStart":0},{"duration":531.8999998569489,"initiatorType":"script","name":"https://jira.mariadb.org/s/0917945aaa57108d00c5076fea35e069-CDN/lu2cib/820016/12ta74/0a8bac35585be7fc6c9cc5a0464cd4cf/_/download/contextbatch/js/_super/batch.js?locale=en","startTime":304.60000014305115,"connectEnd":304.60000014305115,"connectStart":304.60000014305115,"domainLookupEnd":304.60000014305115,"domainLookupStart":304.60000014305115,"fetchStart":304.60000014305115,"redirectEnd":0,"redirectStart":0,"requestStart":361,"responseEnd":836.5,"responseStart":397.60000014305115,"secureConnectionStart":304.60000014305115},{"duration":809.5,"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":304.7999999523163,"connectEnd":304.7999999523163,"connectStart":304.7999999523163,"domainLookupEnd":304.7999999523163,"domainLookupStart":304.7999999523163,"fetchStart":304.7999999523163,"redirectEnd":0,"redirectStart":0,"requestStart":358.2999999523163,"responseEnd":1114.2999999523163,"responseStart":375.7999999523163,"secureConnectionStart":304.7999999523163},{"duration":118.19999980926514,"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":305.10000014305115,"connectEnd":305.10000014305115,"connectStart":305.10000014305115,"domainLookupEnd":305.10000014305115,"domainLookupStart":305.10000014305115,"fetchStart":305.10000014305115,"redirectEnd":0,"redirectStart":0,"requestStart":367,"responseEnd":423.2999999523163,"responseStart":408.60000014305115,"secureConnectionStart":305.10000014305115},{"duration":122.09999990463257,"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":305.2000000476837,"connectEnd":305.2000000476837,"connectStart":305.2000000476837,"domainLookupEnd":305.2000000476837,"domainLookupStart":305.2000000476837,"fetchStart":305.2000000476837,"redirectEnd":0,"redirectStart":0,"requestStart":367.2000000476837,"responseEnd":427.2999999523163,"responseStart":409.2999999523163,"secureConnectionStart":305.2000000476837},{"duration":122.70000004768372,"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":305.40000009536743,"connectEnd":305.40000009536743,"connectStart":305.40000009536743,"domainLookupEnd":305.40000009536743,"domainLookupStart":305.40000009536743,"fetchStart":305.40000009536743,"redirectEnd":0,"redirectStart":0,"requestStart":367.5,"responseEnd":428.10000014305115,"responseStart":409.90000009536743,"secureConnectionStart":305.40000009536743},{"duration":21.399999856948853,"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":305.60000014305115,"connectEnd":0,"connectStart":0,"domainLookupEnd":0,"domainLookupStart":0,"fetchStart":305.60000014305115,"redirectEnd":0,"redirectStart":0,"requestStart":0,"responseEnd":327,"responseStart":0,"secureConnectionStart":0},{"duration":123.09999990463257,"initiatorType":"script","name":"https://jira.mariadb.org/rest/api/1.0/shortcuts/820016/47140b6e0a9bc2e4913da06536125810/shortcuts.js?context=issuenavigation&context=issueaction","startTime":305.7000000476837,"connectEnd":305.7000000476837,"connectStart":305.7000000476837,"domainLookupEnd":305.7000000476837,"domainLookupStart":305.7000000476837,"fetchStart":305.7000000476837,"redirectEnd":0,"redirectStart":0,"requestStart":367.60000014305115,"responseEnd":428.7999999523163,"responseStart":410.60000014305115,"secureConnectionStart":305.7000000476837},{"duration":23.299999952316284,"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":305.90000009536743,"connectEnd":0,"connectStart":0,"domainLookupEnd":0,"domainLookupStart":0,"fetchStart":305.90000009536743,"redirectEnd":0,"redirectStart":0,"requestStart":0,"responseEnd":329.2000000476837,"responseStart":0,"secureConnectionStart":0},{"duration":174.69999980926514,"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":306.10000014305115,"connectEnd":306.10000014305115,"connectStart":306.10000014305115,"domainLookupEnd":306.10000014305115,"domainLookupStart":306.10000014305115,"fetchStart":306.10000014305115,"redirectEnd":0,"redirectStart":0,"requestStart":368,"responseEnd":480.7999999523163,"responseStart":431.7999999523163,"secureConnectionStart":306.10000014305115},{"duration":847.2999999523163,"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":312.5,"connectEnd":312.5,"connectStart":312.5,"domainLookupEnd":312.5,"domainLookupStart":312.5,"fetchStart":312.5,"redirectEnd":0,"redirectStart":0,"requestStart":412.2000000476837,"responseEnd":1159.7999999523163,"responseStart":1143,"secureConnectionStart":312.5},{"duration":845.2000000476837,"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":315,"connectEnd":315,"connectStart":315,"domainLookupEnd":315,"domainLookupStart":315,"fetchStart":315,"redirectEnd":0,"redirectStart":0,"requestStart":412.40000009536743,"responseEnd":1160.2000000476837,"responseStart":1144,"secureConnectionStart":315},{"duration":305.19999980926514,"initiatorType":"xmlhttprequest","name":"https://jira.mariadb.org/rest/webResources/1.0/resources","startTime":1029.6000001430511,"connectEnd":1029.6000001430511,"connectStart":1029.6000001430511,"domainLookupEnd":1029.6000001430511,"domainLookupStart":1029.6000001430511,"fetchStart":1029.6000001430511,"redirectEnd":0,"redirectStart":0,"requestStart":1298.5,"responseEnd":1334.7999999523163,"responseStart":1334,"secureConnectionStart":1029.6000001430511}],"fetchStart":0,"domainLookupStart":54,"domainLookupEnd":69,"connectStart":70,"connectEnd":103,"secureConnectionStart":81,"requestStart":105,"responseStart":279,"responseEnd":309,"domLoading":283,"domInteractive":1586,"domContentLoadedEventStart":1586,"domContentLoadedEventEnd":1657,"domComplete":2149,"loadEventStart":2149,"loadEventEnd":2149,"userAgent":"Mozilla/5.0 AppleWebKit/537.36 (KHTML, like Gecko; compatible; ClaudeBot/1.0; +claudebot@anthropic.com)","marks":[{"name":"bigPipe.sidebar-id.start","time":1556.9000000953674},{"name":"bigPipe.sidebar-id.end","time":1557.9000000953674},{"name":"bigPipe.activity-panel-pipe-id.start","time":1558.1000001430511},{"name":"bigPipe.activity-panel-pipe-id.end","time":1560.2000000476837},{"name":"activityTabFullyLoaded","time":1688.5}],"measures":[],"correlationId":"e07dacc39472c9","effectiveType":"4g","downlink":10,"rtt":0,"serverDuration":98,"dbReadsTimeInMs":11,"dbConnsTimeInMs":18,"applicationHash":"9d11dbea5f4be3d4cc21f03a88dd11d8c8687422","experiments":[]}}
Patching process:
1. Open the file with VIM
2. Write ":%s/read pass/read -r pass/g", press Enter
Patched "1\23"
Unpached "1
23":
Unpached "1\23"
Patched "123"
Unpatched "123"
Patched "1\2\3\"
Unpached "1\\2\\3
"
Unpached "1\2\3\"
You can clearly see that all variants of single-backslash passwords passed to installation script become "123" after the script is done.
On my computer it works the way it should and i get results i expect both in patched and unpatched version.
To be honest i have no idea where did you get that from, i suggest checking it again:
Try typing "1\2\3" in the first prompt, then "123" in retyping, the script will pass through setting "123" password.