- Sponsor
-
Notifications
You must be signed in to change notification settings - Fork 5
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
remote shell panel confused by filenames with '%' #2983
Comments
I confirm the bug.
Steps to reproduce:
Expected result: should be visible the '%d.test.txt' file in list of files |
|
as pointed out in the duplicate (whoops :}), this problem poses a target for format string attacks: while messing up the display with %p is pretty harmless, %n has been used to create exploits before. this makes the VFS unsuitable for browsing any untrusted data, which includes directories of other users on otherwise completely trusted machines. |
Patch of Dieter Werner |
Dieter Werner <d_werner gmx/net> sent me the patch-ls-ub.diff patch in private e-mail. Please review and check it. |
fwiw, that it is in fact already in the perl code makes it less critical than i expected (an %n attack attempt will just yield a warning). i wonder how many similar bugs exist, though ... |
|
|
Replying to andrew_b:
Generally: NO variable at all should ever be part of the format string of
As fefe stated recently: if you're checking for exploits, you start with
I'll add a attachment against master. |
vfs_fish_helpers_ls-percent.diff |
Replying to dnh:
Ok. The same issue is in get:22.
Is "%ld" instead of "%i" should be used for "$size"? |
"get:" ? What's that? ;)
"%ld" does not suffice for >4G sizes on 32bit platforms, IIRC. So it should be "%lld". Not sure how big off_t is everywhere ("%z" for size_t might be a candidate then). And not sure if "%lld" is supported everywhere that mc targets. Time for macros like FMTSTR_OFF_T / configure-replaceable-variables in scripts like @FMTSTR_OFF_T@ or something like that ... Not nice. I might be tempted to just try "%lld", test as much as is easy(-ily feasible) (we build mc for ARMv7l/aarch64 and ppc/ppc64 too) and then wait for bugreports ... But then, I'm not mc (code-)maintainer, just a packager ;) |
Replying to dnh:
This is script to get a file from remote host.
I checked that before. "%lld" is not supported in my distro with perl-5.12.5. |
Replying to andrew_b:
Ah.
What libc? Perl itself has that for ages IIRC (5.005 even?)
$ perldoc -f sprintf
Generally, we should find out what format-string should be used for ints >32bit and figure that out in configure etc. In this special case, as the data is coming from a stat call, we can get away with a '%s' format string:
Here, %i and %ld also work in perl, but this is a 64bit platform + perl. |
the last comment belongs into the other ticket and should be just deleted here.
i don't know what you are making a fuss about. if the contents of a variable are strictly defined, it is perfectly reasonable to include it in the format string, and for numbers this is certainly the case. you need more than dogmatism to be convincing. |
Replying to dnh:
The Perl code in the ls helper is valid (http://www.perlmonks.org/?node_id=918845, for example). We do not expected any strange values for uid, gid and size returned from lstat(). |
Important
This issue was migrated from Trac:
yury_t
dnh@….org
When opening remote dir in remote shell panel, file with names containing '%' are shown as errors and inaccessible (red highlights with leading '?').
Note
Original attachments:
andrew_b
(@aborodin) onMar 14, 2014 at 4:46 UTC
dnh
(dnh@….org) onMar 15, 2014 at 13:48 UTC
The text was updated successfully, but these errors were encountered: