ftpd authentication [PATCH] ftpd: NOMMU/chroot fix
Denys Vlasenko
vda.linux at googlemail.com
Thu Jun 26 10:43:27 UTC 2014
On Thu, Jun 26, 2014 at 11:45 AM, Morten Kvistgaard
<MK at pch-engineering.dk> wrote:
> I've attached my strace.
>
> I'm not sure that it tells me anything though.
> I've run: sudo strace -p<inetd_pid> -f -o ftpd.strace
> Is there a better way?
>
> Anyway, the current code will exit jail with the following code:
>
> ...
> if (fchdir(G.root_fd) != 0)
> _exit(127);
> ...
>
> But on my Ubuntu and uClinux that's not enough to break out of jail.
What do you mean? In your strace, fchdir succeeds:
15144 fchdir(3 <unfinished ...>
15143 <... mmap2 resumed> ) = 0xb77d0000
15144 <... fchdir resumed> ) = 0
> And so the following code will fail:
>
> ...
> /* + 1: we must use relative path here if in chroot.
> * For example, execv("/proc/self/exe") will fail, since
> * it looks for "/proc/self/exe" _relative to chroot!_ */
> execv(bb_busybox_exec_path + 1, (char**) argv);
> _exit(127);
> ...
>
>
> The strace might reflect this:
> ...
> execve("proc/self/exe", ["ftpd", "-l", "/"], [/* 9 vars */]) = -1 ENOENT (No such file or directory)
> ...
This is strange. Any ideas why this fails on your machine?
More information about the busybox
mailing list