Can hackers inject anything to the server outside /var/www/html
We got hack because of a bad security on our server. The hacker got access of the database probably from a php file holding database credentials in the html folder. The /var/www/html folder had root privileges and 777 permissions.
Could the hacker have had injected anything outside the /var/www/html folder? Do we have to reset our server, or proper security would do?
Note that we already changed permissions and ownership of the html folder and files inside. We also changed the database credentials and implemented some MySQL security. Also blocked all ports except for the http, https and ssh port (change the ssh port as well)
apache2 security hacking
add a comment |
We got hack because of a bad security on our server. The hacker got access of the database probably from a php file holding database credentials in the html folder. The /var/www/html folder had root privileges and 777 permissions.
Could the hacker have had injected anything outside the /var/www/html folder? Do we have to reset our server, or proper security would do?
Note that we already changed permissions and ownership of the html folder and files inside. We also changed the database credentials and implemented some MySQL security. Also blocked all ports except for the http, https and ssh port (change the ssh port as well)
apache2 security hacking
2
There's never a way to be sure. Nuke the server from the orbit and reinstall if you had backup or start over again.
– Sergiy Kolodyazhnyy
Jan 29 at 14:56
It depends how they got access to the server. Maybe they managed to discover some user's password that has sudo access. In that case, I would assume the worst.
– Dan
Jan 29 at 14:56
1
It is not right on the topic, but here are presented few ideas about Apache's security improvement: I need rules to drop some malicious Apache connection
– pa4080
Jan 29 at 16:05
seems the only way they got there is from the permissions, there were no other sudo users than root and we didnt have a backup. Since there was no backup, its gonna be a pain to reconfigure everything that's why I need to if they were able to get past the html folder. What do u think?
– Cayenne
Jan 29 at 19:38
add a comment |
We got hack because of a bad security on our server. The hacker got access of the database probably from a php file holding database credentials in the html folder. The /var/www/html folder had root privileges and 777 permissions.
Could the hacker have had injected anything outside the /var/www/html folder? Do we have to reset our server, or proper security would do?
Note that we already changed permissions and ownership of the html folder and files inside. We also changed the database credentials and implemented some MySQL security. Also blocked all ports except for the http, https and ssh port (change the ssh port as well)
apache2 security hacking
We got hack because of a bad security on our server. The hacker got access of the database probably from a php file holding database credentials in the html folder. The /var/www/html folder had root privileges and 777 permissions.
Could the hacker have had injected anything outside the /var/www/html folder? Do we have to reset our server, or proper security would do?
Note that we already changed permissions and ownership of the html folder and files inside. We also changed the database credentials and implemented some MySQL security. Also blocked all ports except for the http, https and ssh port (change the ssh port as well)
apache2 security hacking
apache2 security hacking
edited Jan 29 at 14:38
Cayenne
asked Jan 29 at 14:29
CayenneCayenne
153
153
2
There's never a way to be sure. Nuke the server from the orbit and reinstall if you had backup or start over again.
– Sergiy Kolodyazhnyy
Jan 29 at 14:56
It depends how they got access to the server. Maybe they managed to discover some user's password that has sudo access. In that case, I would assume the worst.
– Dan
Jan 29 at 14:56
1
It is not right on the topic, but here are presented few ideas about Apache's security improvement: I need rules to drop some malicious Apache connection
– pa4080
Jan 29 at 16:05
seems the only way they got there is from the permissions, there were no other sudo users than root and we didnt have a backup. Since there was no backup, its gonna be a pain to reconfigure everything that's why I need to if they were able to get past the html folder. What do u think?
– Cayenne
Jan 29 at 19:38
add a comment |
2
There's never a way to be sure. Nuke the server from the orbit and reinstall if you had backup or start over again.
– Sergiy Kolodyazhnyy
Jan 29 at 14:56
It depends how they got access to the server. Maybe they managed to discover some user's password that has sudo access. In that case, I would assume the worst.
– Dan
Jan 29 at 14:56
1
It is not right on the topic, but here are presented few ideas about Apache's security improvement: I need rules to drop some malicious Apache connection
– pa4080
Jan 29 at 16:05
seems the only way they got there is from the permissions, there were no other sudo users than root and we didnt have a backup. Since there was no backup, its gonna be a pain to reconfigure everything that's why I need to if they were able to get past the html folder. What do u think?
– Cayenne
Jan 29 at 19:38
2
2
There's never a way to be sure. Nuke the server from the orbit and reinstall if you had backup or start over again.
– Sergiy Kolodyazhnyy
Jan 29 at 14:56
There's never a way to be sure. Nuke the server from the orbit and reinstall if you had backup or start over again.
– Sergiy Kolodyazhnyy
Jan 29 at 14:56
It depends how they got access to the server. Maybe they managed to discover some user's password that has sudo access. In that case, I would assume the worst.
– Dan
Jan 29 at 14:56
It depends how they got access to the server. Maybe they managed to discover some user's password that has sudo access. In that case, I would assume the worst.
– Dan
Jan 29 at 14:56
1
1
It is not right on the topic, but here are presented few ideas about Apache's security improvement: I need rules to drop some malicious Apache connection
– pa4080
Jan 29 at 16:05
It is not right on the topic, but here are presented few ideas about Apache's security improvement: I need rules to drop some malicious Apache connection
– pa4080
Jan 29 at 16:05
seems the only way they got there is from the permissions, there were no other sudo users than root and we didnt have a backup. Since there was no backup, its gonna be a pain to reconfigure everything that's why I need to if they were able to get past the html folder. What do u think?
– Cayenne
Jan 29 at 19:38
seems the only way they got there is from the permissions, there were no other sudo users than root and we didnt have a backup. Since there was no backup, its gonna be a pain to reconfigure everything that's why I need to if they were able to get past the html folder. What do u think?
– Cayenne
Jan 29 at 19:38
add a comment |
1 Answer
1
active
oldest
votes
Assuming you're using a basic Apache2 setup, all apache2 processes and PHP code executed was ran as the user:group www-data:www-data which limits where it can write data. An attacker would likely have access to:
Your SQL databases since the credentials very likely had to be stored somewhere
www-datacould read, otherwise your web-app (eg. Wordpress) wouldn't be capable of connecting to your database.Any files in your
/home/*directories, except files where permissions were600or similar, such as SSH keys. This means an attacker wouldn't have access to your SSH keys under most circumstances.Any API tokens ore other files stored in
/var/www/htmlAny configuration files in
/etcthat didn't have restricted permissions. It's worth noting that/etc/letsencrypt/livehas restricted permissions and cannot be read viawww-dataso your SSL keys should be safe.
In any case I would suggest distrusting any credentials on the system, such as SSH keys, API tokens and issuing new SSL certificates to be safe. You can so do a find / -group www-data to see any files created by www-data since there could be some random areas writable such as /tmp, places PHP sessions are stored, /var/run, etc.
add a comment |
Your Answer
StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "89"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});
function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});
}
});
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2faskubuntu.com%2fquestions%2f1113823%2fcan-hackers-inject-anything-to-the-server-outside-var-www-html%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
Assuming you're using a basic Apache2 setup, all apache2 processes and PHP code executed was ran as the user:group www-data:www-data which limits where it can write data. An attacker would likely have access to:
Your SQL databases since the credentials very likely had to be stored somewhere
www-datacould read, otherwise your web-app (eg. Wordpress) wouldn't be capable of connecting to your database.Any files in your
/home/*directories, except files where permissions were600or similar, such as SSH keys. This means an attacker wouldn't have access to your SSH keys under most circumstances.Any API tokens ore other files stored in
/var/www/htmlAny configuration files in
/etcthat didn't have restricted permissions. It's worth noting that/etc/letsencrypt/livehas restricted permissions and cannot be read viawww-dataso your SSL keys should be safe.
In any case I would suggest distrusting any credentials on the system, such as SSH keys, API tokens and issuing new SSL certificates to be safe. You can so do a find / -group www-data to see any files created by www-data since there could be some random areas writable such as /tmp, places PHP sessions are stored, /var/run, etc.
add a comment |
Assuming you're using a basic Apache2 setup, all apache2 processes and PHP code executed was ran as the user:group www-data:www-data which limits where it can write data. An attacker would likely have access to:
Your SQL databases since the credentials very likely had to be stored somewhere
www-datacould read, otherwise your web-app (eg. Wordpress) wouldn't be capable of connecting to your database.Any files in your
/home/*directories, except files where permissions were600or similar, such as SSH keys. This means an attacker wouldn't have access to your SSH keys under most circumstances.Any API tokens ore other files stored in
/var/www/htmlAny configuration files in
/etcthat didn't have restricted permissions. It's worth noting that/etc/letsencrypt/livehas restricted permissions and cannot be read viawww-dataso your SSL keys should be safe.
In any case I would suggest distrusting any credentials on the system, such as SSH keys, API tokens and issuing new SSL certificates to be safe. You can so do a find / -group www-data to see any files created by www-data since there could be some random areas writable such as /tmp, places PHP sessions are stored, /var/run, etc.
add a comment |
Assuming you're using a basic Apache2 setup, all apache2 processes and PHP code executed was ran as the user:group www-data:www-data which limits where it can write data. An attacker would likely have access to:
Your SQL databases since the credentials very likely had to be stored somewhere
www-datacould read, otherwise your web-app (eg. Wordpress) wouldn't be capable of connecting to your database.Any files in your
/home/*directories, except files where permissions were600or similar, such as SSH keys. This means an attacker wouldn't have access to your SSH keys under most circumstances.Any API tokens ore other files stored in
/var/www/htmlAny configuration files in
/etcthat didn't have restricted permissions. It's worth noting that/etc/letsencrypt/livehas restricted permissions and cannot be read viawww-dataso your SSL keys should be safe.
In any case I would suggest distrusting any credentials on the system, such as SSH keys, API tokens and issuing new SSL certificates to be safe. You can so do a find / -group www-data to see any files created by www-data since there could be some random areas writable such as /tmp, places PHP sessions are stored, /var/run, etc.
Assuming you're using a basic Apache2 setup, all apache2 processes and PHP code executed was ran as the user:group www-data:www-data which limits where it can write data. An attacker would likely have access to:
Your SQL databases since the credentials very likely had to be stored somewhere
www-datacould read, otherwise your web-app (eg. Wordpress) wouldn't be capable of connecting to your database.Any files in your
/home/*directories, except files where permissions were600or similar, such as SSH keys. This means an attacker wouldn't have access to your SSH keys under most circumstances.Any API tokens ore other files stored in
/var/www/htmlAny configuration files in
/etcthat didn't have restricted permissions. It's worth noting that/etc/letsencrypt/livehas restricted permissions and cannot be read viawww-dataso your SSL keys should be safe.
In any case I would suggest distrusting any credentials on the system, such as SSH keys, API tokens and issuing new SSL certificates to be safe. You can so do a find / -group www-data to see any files created by www-data since there could be some random areas writable such as /tmp, places PHP sessions are stored, /var/run, etc.
answered Jan 29 at 14:41
Kristopher IvesKristopher Ives
2,87211525
2,87211525
add a comment |
add a comment |
Thanks for contributing an answer to Ask Ubuntu!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2faskubuntu.com%2fquestions%2f1113823%2fcan-hackers-inject-anything-to-the-server-outside-var-www-html%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
2
There's never a way to be sure. Nuke the server from the orbit and reinstall if you had backup or start over again.
– Sergiy Kolodyazhnyy
Jan 29 at 14:56
It depends how they got access to the server. Maybe they managed to discover some user's password that has sudo access. In that case, I would assume the worst.
– Dan
Jan 29 at 14:56
1
It is not right on the topic, but here are presented few ideas about Apache's security improvement: I need rules to drop some malicious Apache connection
– pa4080
Jan 29 at 16:05
seems the only way they got there is from the permissions, there were no other sudo users than root and we didnt have a backup. Since there was no backup, its gonna be a pain to reconfigure everything that's why I need to if they were able to get past the html folder. What do u think?
– Cayenne
Jan 29 at 19:38