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

chankro: bad wrapper #2342

Closed
noraj opened this issue May 19, 2019 · 7 comments
Closed

chankro: bad wrapper #2342

noraj opened this issue May 19, 2019 · 7 comments

Comments

@noraj
Copy link
Contributor

noraj commented May 19, 2019

$ chankro --arch 64 --input /tmp/script.sh --output chankro.php --path /var/www/html/upload 


     -=[ Chankro ]=-
    -={ @TheXC3LL }=-


Traceback (most recent call last):
  File "/usr/share/chankro/chankro.py", line 58, in <module>
    with open(archi, "rb") as bicho:
IOError: [Errno 2] No such file or directory: 'hook64.so'

$ ls /usr/share/chankro/          
chankro.py  hook32.so  hook64.so  hook.c

$ which chankro
/usr/bin/chankro

$ cat /usr/bin/chankro
#!/bin/sh
exec python2 /usr/share/chankro/chankro.py "${@}"

But if changing /usr/bin/chankro to

#!/bin/sh
cd /usr/share/chankro/
exec python2 chankro.py "${@}"

Chankro can't write to /usr/share/chankro/

$ chankro --arch 64 --input /tmp/script.sh --output chankro.php --path /var/www/html/upload


     -=[ Chankro ]=-
    -={ @TheXC3LL }=-


[!] Error: file could not be created

This force the use to specify an absolute path for output.

Upstream maintainer should write to the path the script was call rather than the working dir of the script for relative path. Or better change the loading mechanism of hook64.so by using something like $install_dir/hook64.so rather than ./hook64.so.

@noptrix
Copy link
Contributor

noptrix commented May 19, 2019

thx @noraj - this is just a 'cd /usr/share/$pkgname/ ... exec python2 $pkgname.py "$@"' we need to replace. shall i do it quickly?

@noraj
Copy link
Contributor Author

noraj commented May 19, 2019

@noptrix No, see my update.

@noptrix
Copy link
Contributor

noptrix commented May 19, 2019

@noptrix No, see my update.

this is nothing new and a lot of tools are like that (that's why r00t is prefered :)) -- so my suggestion is to fix it now and wait also for the upstream changes.

@noraj
Copy link
Contributor Author

noraj commented May 19, 2019

@noptrix We can't fix it now, it will depends if the fix is about fixing the path of the hook or fix the path of the output.

@noraj
Copy link
Contributor Author

noraj commented May 19, 2019

@noptrix I made the upstream fix see TarlogicSecurity/Chankro#4

@noraj
Copy link
Contributor Author

noraj commented May 20, 2019

@noptrix upstream merged.

@noptrix
Copy link
Contributor

noptrix commented May 22, 2019

@noraj thanks! will revert our patch and use upstream fixed version.

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