Skip to content
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

dropbear for android error fstatat64(AT_FDCWD, "//.ssh #255

Closed
TianRandai111 opened this issue Sep 12, 2023 · 1 comment
Closed

dropbear for android error fstatat64(AT_FDCWD, "//.ssh #255

TianRandai111 opened this issue Sep 12, 2023 · 1 comment

Comments

@TianRandai111
Copy link

My computer environment:

$  uname -a                                                                                                                                                        
Linux localhost 4.9.113 #1 SMP PREEMPT Wed Dec 15 12:08:54 CST 2021 armv7l

$ echo $SHELL                                                                                                                                                 
/system/bin/sh

$ echo $USER                                                                                                                                                      
root

$ echo $HOME                                                                                                                                                      
/data

error:
strace -f /data/local/tmp/usr/local/sbin/dropbear -F -E -p 2222 -r /data/.ssh/id_dropbear

[pid  1677] openat(AT_FDCWD, "/data/.ssh/shells", O_RDONLY|O_LARGEFILE) = 5
[pid  1677] fstat64(5, {st_mode=S_IFREG|0644, st_size=115, ...}) = 0
[pid  1677] fstat64(5, {st_mode=S_IFREG|0644, st_size=115, ...}) = 0
[pid  1677] read(5, "# /etc/shells: valid login shell"..., 4096) = 115
[pid  1677] read(5, "", 4096)           = 0
[pid  1677] close(5)                    = 0
[pid  1677] madvise(0xb0f17000, 4096, MADV_DONTNEED) = 0
[pid  1677] madvise(0xb0f2e000, 20480, MADV_DONTNEED) = 0
[pid  1677] getuid32()                  = 0
[pid  1677] getgid32()                  = 0
[pid  1677] setresgid32(-1, 0, -1)      = 0
[pid  1677] setresuid32(-1, 0, -1)      = 0
[pid  1677] fstatat64(AT_FDCWD, "/", {st_mode=S_IFDIR|0755, st_size=0, ...}, 0) = 0
[pid  1677] fstatat64(AT_FDCWD, "//.ssh", 0xbbd56538, 0) = -1 ENOENT (No such file or directory)
[pid  1677] setresuid32(-1, 0, -1)      = 0
[pid  1677] setresgid32(-1, 0, -1)      = 0
[pid  1677] madvise(0xb0f33000, 20480, MADV_DONTNEED) = 0
[pid  1677] writev(0, [{iov_base="bE\350\256a>d\220\350\20\21\226<{\220\356W\333\204\375_\226\36\314!+\214\33\20\370\207v"..., iov_len=44}], 1) = 44
[pid  1677] madvise(0xb0f2e000, 12288, MADV_DONTNEED) = 0
[pid  1677] pselect6(5, [0 3], [], NULL, {tv_sec=301, tv_nsec=0}, NULL) = 1 (in [0], left {tv_sec=300, tv_nsec=998957500})
[pid  1677] read(0, "", 8)              = 0
[pid  1677] close(0)                    = 0
[pid  1677] openat(AT_FDCWD, "/dev/__properties__/u:object_r:exported_system_prop:s0", O_RDONLY|O_LARGEFILE|O_NOFOLLOW|O_CLOEXEC) = 0
[pid  1677] fstat64(0, {st_mode=S_IFREG|0444, st_size=131072, ...}) = 0
[pid  1677] mmap2(NULL, 131072, PROT_READ, MAP_SHARED, 0, 0) = 0xb1104000
[pid  1677] close(0)                    = 0
[pid  1677] openat(AT_FDCWD, "/data/misc/zoneinfo/current/tzdata", O_RDONLY|O_LARGEFILE|O_CLOEXEC) = 0
[pid  1677] read(0, "tzdata2018e\0\0\0\0\30\0\0x$\0\7\\x", 24) = 24
[pid  1677] lseek(0, 24, SEEK_SET)      = 24
[pid  1677] read(0, "Africa/Abidjan\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"..., 30732) = 30732
[pid  1677] madvise(0xb0f47000, 36864, MADV_DONTNEED) = 0
[pid  1677] lseek(0, 295759, SEEK_SET)  = 295759
[pid  1677] read(0, "TZif2\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\2\0\0\0\2\0\0\0\0"..., 388) = 388
[pid  1677] close(0)                    = 0
[pid  1677] openat(AT_FDCWD, "/data/misc/zoneinfo/current/tzdata", O_RDONLY|O_LARGEFILE|O_CLOEXEC) = 0
[pid  1677] read(0, "tzdata2018e\0\0\0\0\30\0\0x$\0\7\\x", 24) = 24
[pid  1677] lseek(0, 24, SEEK_SET)      = 24
[pid  1677] read(0, "Africa/Abidjan\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"..., 30732) = 30732
[pid  1677] madvise(0xb0f56000, 36864, MADV_DONTNEED) = 0
[pid  1677] close(0)                    = 0
[pid  1677] openat(AT_FDCWD, "/system/usr/share/zoneinfo/tzdata", O_RDONLY|O_LARGEFILE|O_CLOEXEC) = 0
[pid  1677] read(0, "tzdata2018e\0\0\0\0\30\0\0x$\0\7\\x", 24) = 24
[pid  1677] lseek(0, 24, SEEK_SET)      = 24
[pid  1677] read(0, "Africa/Abidjan\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"..., 30732) = 30732
[pid  1677] madvise(0xb0f56000, 36864, MADV_DONTNEED) = 0
[pid  1677] close(0)                    = 0
[pid  1677] madvise(0xb0f47000, 61440, MADV_DONTNEED) = 0
[pid  1677] madvise(0xb0f38000, 61440, MADV_DONTNEED) = 0
[pid  1677] write(2, "[1677] Sep 12 16:46:56 Exit befo"..., 108[1677] Sep 12 16:46:56 Exit before auth from <192.168.6.202:40262>: (user 'root', 0 fails): Exited normally
) = 108
[pid  1677] fstatat64(AT_FDCWD, "/", {st_mode=S_IFDIR|0755, st_size=0, ...}, 0) = 0
[pid  1677] fstatat64(AT_FDCWD, "//.ssh", 0xbbd56538, 0) = -1 ENOENT (No such file or directory)

dropbear read path //.ssh, but my environment no has //.ssh, Where should I modify the C code file

@mkj
Copy link
Owner

mkj commented Sep 12, 2023

I think that fstatat64 is from

if (checkfileperm(filename) != DROPBEAR_SUCCESS) {

The home directory gets filled out by getpwnam(), you could update pw_dir in fill_passwd() I guess.

ses.authstate.pw_dir = m_strdup(pw->pw_dir);

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants