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

peotry package software may spit out this error message : [Errno 13] Permission denied: '/usr/share/netexec/virtualenvs/envs.toml' but has no incidence on tool functionality #4069

Open
1 of 2 tasks
AkechiShiro opened this issue Jan 25, 2024 · 2 comments
Labels
type::bug Valid bug

Comments

@AkechiShiro
Copy link

AkechiShiro commented Jan 25, 2024

  • I have searched open and closed issues for duplicates
  • I am submitting a bug report for existing functionality that does not work as intended

I did not find any existing functionality not working as intended, I'm reporting this bug just for documentation purpose and if someone wants to further investigate a possible fix in the future.


Bug description

netexec run as user after installation cannot read envs.toml in virtualenvs, I don't think this is as intended, or are we supposed to run netexec as root ?

Steps to reproduce

  • sudo pacman -S netexec
  • run netexec as a normal user.
  • that reproduce the bug

Actual result: Describe here what happens after you run the steps above (i.e. the buggy behaviour)
The tool works fine but fails to read this configuration file :

  • [Errno 13] Permission denied: '/usr/share/netexec/virtualenvs/envs.toml'

Expected result: Describe here what should happen after you run the steps above (i.e. what would be the correct behaviour)
I believe that the tool should have the permission to read this file inside the virtualenvs folder, however I'm not sure about the use case for this file, it seems related to the poetry virtual environment.

Screenshots

Info for developers

GNU/Linux distribution: ArchLinux with BlackArch repositories added.
Tool version: v1.1.0.r70.g9df72e2f-1

Link to debug log

[Errno 13] Permission denied: '/usr/share/netexec/virtualenvs/envs.toml'
[*] First time use detected
[*] Creating home directory structure
[*] Creating missing folder logs
[*] Creating missing folder modules
[*] Creating missing folder protocols
[*] Creating missing folder workspaces
[*] Creating missing folder obfuscated_scripts
[*] Creating missing folder screenshots
[*] Copying default configuration file
usage: netexec [-h] [-t THREADS] [--timeout TIMEOUT] [--jitter INTERVAL] [--no-progress] [--verbose] [--debug] [--version]
               {ftp,ldap,mssql,rdp,smb,ssh,vnc,winrm,wmi} ...
@AkechiShiro AkechiShiro added the type::bug Valid bug label Jan 25, 2024
@noraj
Copy link
Contributor

noraj commented Jan 26, 2024

I believe that the tool should have the permission to read this file inside the virtualenvs folder

I don't believe this is a read issue. In fact /usr/share/netexec/virtualenvs/envs.toml doesn't exist. On the contrary, I think nxc is trying to create but can't as it's a root / write-protected folder.

➜ ls -lh /usr/share/netexec/virtualenvs/envs.toml                                                                                                                                                                    
ls: cannot access '/usr/share/netexec/virtualenvs/envs.toml': No such file or directory 

Once you executed the tool a root with sudo once, the file is created. You still have the issue after that, but you don't have the issue as long as you run it as root.

➜ sudo nxc…
Using virtualenv: /usr/share/netexec/virtualenvs/netexec-PWU1S8Zj-py3.11   
…

➜ nxc…
[Errno 13] Permission denied: '/usr/share/netexec/virtualenvs/envs.toml'

nxc is able to read it as everyone, but it's writing that is required at each execution.

➜ ls -ls /usr/share/netexec/virtualenvs/envs.toml
4 -rw-r--r-- 1 root root 51 janv. 26 09:21 /usr/share/netexec/virtualenvs/envs.toml

It's not an issue of nxc but rather of the poetry virtualenv.

There is maybe an option to circumvent that with poetry so if you find how, let me know.

@AkechiShiro
Copy link
Author

Thanks, I'll try to have a look at poetry and let you know if I find anything, you are correct the file does not exists.

I do agree with you this is an issue with peotry and not netexec.

@AkechiShiro AkechiShiro changed the title netexec : [Errno 13] Permission denied: '/usr/share/netexec/virtualenvs/envs.toml' but has no incidence on tool functionality peotry package software may spit out this error message : [Errno 13] Permission denied: '/usr/share/netexec/virtualenvs/envs.toml' but has no incidence on tool functionality Jan 26, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type::bug Valid bug
Projects
None yet
Development

No branches or pull requests

2 participants