-
Notifications
You must be signed in to change notification settings - Fork 63
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
shell_exec #169
Comments
You mean a different way to execute shell commands? Because without shell, it's probably hard to get system information, not sure perhaps there are modules or other ways to get this. |
Errors on lines 79 and 87 are about uptime. I have read that uptime can be read with file_get_contents. I can't write code so I don't know if it's suitable here. Or is it any safer... If there are no other ways to do this. Is it possible to get rid of the errors in the log? |
Regarding Uptime calculation, for Linux systems at least you can read /proc/uptime to get the seconds since last boot as the first number in the file. There's also /proc/net/dev that can be used to determine network interface usage, at least accumulated usage. This would be perfectly secure as they're publicly readable "files" that any user on the system can read, with no sensitive information. |
as @kesselb already said in the original issue nextcloud/server#18659 (comment), you will be able to get most if not all of the information without shell_exec. So instead of doing |
I already replaced the shell_exec call for /proc/meminfo here: #183. I will look into:
|
What about serverinfo/lib/OperatingSystems/DefaultOs.php Line 209 in 9dfa5dd
|
Could work together with /proc/mounts. |
It looks like this has already been solved with the protected functions @kesselb I guess this issue can be closed :) |
serverinfo/lib/OperatingSystems/DefaultOs.php Lines 217 to 231 in 3230b6e
|
The |
The issue is to avoid |
|
|
@J0WI I see what you mean, thanks for the insight on this and I kind of agree, to keep functions as open as possible, in case someone can't use certain PHP functionality, due to restrictions. Unless someone else is quicker changing it and creating a pull request, I'm happy to have a look at it. |
I'm already working on a new version of the network information parser: https://gist.github.com/kesselb/1d40c6f3c3491c8ecd59dcbb4ae5ea8d It still needs |
That looks good 👍 |
Shouldn't we also check if we can |
I would like to dig out this issue, as I've come to find out the "System" Settings tab is inaccessible without access to root level applications like ifconfig. This makes the mentioned "System" tab throw a 500 error no matter if the shell_exec is allowed or not. |
Still hope people are thinking about this |
This Arbitrary code execution vector needs to be fixed, urgently. Not only because it is unnecessary to retreive the system information via Thanks |
Thanks to open source, you don't have to wait for Nextcloud, you can act yourself, pull requests are welcome. |
True that! |
One less use of shell_exec(). Maintains same output format typically used by `date` so no changes needed elsewhere Relevant to nextcloud#169 and possibly nextcloud#347 Signed-off-by: Josh Richards <josh.t.richards@gmail.com>
Hi, could you please give the above script a test and let me know if it detects your gateway properly? |
Is it possible to not use shell_exec because it's unsafe? There are people who have disabled it and that's causing errors. Of course that also means something isn't working.
error shell_exec() has been disabled for security reasons
Steps to reproduce
1.Install NC18.0.0 RC1 with PHP 7.4.1
2.Open the NC and go to the settings/system information
3.See log
Expected behaviour
No errors
Actual behaviour
I got errors and for example I can't see network information
Server configuration
Operating system: Centos 7.8
Web server: Nginx 1.17.7
Database: MariaDB 10.3.21
PHP version: 7.4.1
Nextcloud version: Nextcloud 18.0.0 RC1
Updated from an older Nextcloud/ownCloud or fresh install: fresh
Where did you install Nextcloud from: download.nextcloud.com
Signing status:
Signing status
List of activated apps:
Are you using external storage, if yes which one: no
Are you using encryption: no
Are you using an external user-backend, if yes which one: no
Logs
Nextcloud log (data/nextcloud.log)
Nextcloud log
The text was updated successfully, but these errors were encountered: