dongxiao_0528 2016-10-05 13:46
浏览 83

尝试使用shell_exec执行二进制文件

It's maybe more a bash oriented question, but it deals with security.

So I'm trying to download a binary (nc) from a remote machine that I can access using Php (and shell_exec function), I looked for wget and found it in /usr/ports/ftp/ repository, with the following rights:

drwxr-xr-x  3 root  wheel   512 Dec 27  2013 wget

So, as you can see everybody should be abble to execute this. So, I did the following with shell_exec:

<?php $output = shell_exec("/usr/ports/ftp/wget"); echo "<pre>$output</pre>"; ?>

But when I executed this script via the server nothing append, which is strange because shell_exec(ls"); works (it can see the stdout of it) and "ls" binary which is in /bin as exaclty the same rights

Any suggestion ?

p.s: all of this happens in a training lab of course

  • 写回答

1条回答 默认 最新

  • dousao6313 2016-10-07 02:43
    关注

    This looks like a BSD machine - /usr/ports/ftp/wget is a directory (see the d in the modes of the ls output). wget is not actually installed on that machine, I suspect, and you're trying to execute a directory.

    Try fetch (/usr/bin/fetch) instead.

    评论

报告相同问题?

悬赏问题

  • ¥15 素材场景中光线烘焙后灯光失效
  • ¥15 请教一下各位,为什么我这个没有实现模拟点击
  • ¥15 执行 virtuoso 命令后,界面没有,cadence 启动不起来
  • ¥50 comfyui下连接animatediff节点生成视频质量非常差的原因
  • ¥20 有关区间dp的问题求解
  • ¥15 多电路系统共用电源的串扰问题
  • ¥15 slam rangenet++配置
  • ¥15 有没有研究水声通信方面的帮我改俩matlab代码
  • ¥15 ubuntu子系统密码忘记
  • ¥15 保护模式-系统加载-段寄存器