双方dhclient
并dhcpcd
调用配置脚本调用系统shell,所以他们是脆弱的。
但是,根据我的测试,看起来您至少可以在dhcpcd
没有配置脚本的情况下成功运行(如果您重命名/移动脚本):
$ pkill dhcpcd
$ ping -c 1 www.google.com
ping: unknown host www.google.com
$ mv /usr/lib/dhcpcd/dhcpcd-run-hooks /usr/lib/dhcpcd/dhcpcd-run-hooks-disabled
$ dhcpcd
dhcpcd[29057]: version 6.4.3 starting
dhcpcd[29057]: script_runreason: /usr/lib/dhcpcd/dhcpcd-run-hooks: WEXITSTATUS 127
(...)
dhcpcd[29057]: forked to background, child pid 29069
$ ping -c 1 www.google.com
PING www.google.com (74.125.232.240) 56(84) bytes of data.
64 bytes from arn06s07-in-f16.1e100.net (74.125.232.240): icmp_seq=1 ttl=54 time=16.4 ms
(...)
如您所见,有一个警告,但最终建立了连接。
可能会有一些设置不正确的东西(例如域),所以这是一个骇人听闻的解决方案。我没有在 WiFi 网络上测试过,它可能会在那里失败。
编辑:基于strings /usr/bin/dhcpcd
它看起来脚本路径是硬编码的。