# Website Invaded

**URL:** <https://discourse.cakephp.org/t/website-invaded/3023>\
**Category:** Uncategorized\
**Created:** [August 11, 2017, 9:28pm UTC](https://discourse.cakephp.org/t/website-invaded/3023 "2017-08-11T21:28:23Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![grupoviabr](https://avatars.discourse-cdn.com/v4/letter/g/8dc957/32.png) [@grupoviabr](https://discourse.cakephp.org/u/grupoviabr)\
**Post date:** [August 11, 2017, 9:28pm UTC](https://discourse.cakephp.org/t/website-invaded/3023/1 "2017-08-11T21:28:23Z")

</div>

Hello people,  
I have a site in cakephp 3, it has the correct permissions following the recommendations.

It was invaded a few times.

In the root folder opens some files also inside the webroot folder appears several.

It has already happened that index.php has been edited.

Any solution?

---

<div class="post-metadata">

**Author:** ![dakota](https://yyz1.discourse-cdn.com/flex029/user_avatar/discourse.cakephp.org/dakota/32/1421_2.png) [@dakota](https://discourse.cakephp.org/u/dakota)\
**Post date:** [August 16, 2017, 9:58am UTC](https://discourse.cakephp.org/t/website-invaded/3023/2 "2017-08-16T09:58:42Z")

</div>

You’ll need to figure out how the attackers gained access to your site. It was probably via some vector like FTP.

Once a server has been compromise like that, you MUST do a full rebuild of the server from the ground up. You have no way of knowing what/if the attackers installed on the server. Most of the time, they will install something on the server that will allow them access even if you fix the site’s code, and change passwords.

---

<div class="post-metadata">

**Author:** ![grupoviabr](https://avatars.discourse-cdn.com/v4/letter/g/8dc957/32.png) [@grupoviabr](https://discourse.cakephp.org/u/grupoviabr)\
**Post date:** [August 17, 2017, 6:40am UTC](https://discourse.cakephp.org/t/website-invaded/3023/3 "2017-08-17T06:40:55Z")

</div>

But this invader when it has access to the public\_html directory is it possible to install something inside the server?

Inside the webroot folder was full of malicious files, I removed and reinstalled the framework.

I do not know how to block the attacker.

Because I do not believe it is a Framework failure

---

<div class="post-metadata">

**Author:** ![dakota](https://yyz1.discourse-cdn.com/flex029/user_avatar/discourse.cakephp.org/dakota/32/1421_2.png) [@dakota](https://discourse.cakephp.org/u/dakota)\
**Post date:** [August 17, 2017, 7:24am UTC](https://discourse.cakephp.org/t/website-invaded/3023/4 "2017-08-17T07:24:11Z")

</div>

Yes, it is very possible for an attacker to install something on the server. If they have the ability to upload, and execute arbitrary PHP code, then they can install anything that they want.

The only way to safely deal with this is to rebuild the server from scratch, and ensure that you use a known clean version of your website. You should then ensure that the only way to log into the server is a secure SSH connection with a private/public key and no passwords. Also, setup something like fail2ban to ensure that brute force attacks are not viable.

---

<div class="post-metadata">

**Author:** ![grupoviabr](https://avatars.discourse-cdn.com/v4/letter/g/8dc957/32.png) [@grupoviabr](https://discourse.cakephp.org/u/grupoviabr)\
**Post date:** [August 17, 2017, 11:57am UTC](https://discourse.cakephp.org/t/website-invaded/3023/5 "2017-08-17T11:57:00Z")

</div>

A cakephp 3 crash is not possible right?  
More like they can send files inside a site without access to my FTP?  
Got any way to block?

I’m looking for a way to not have to rebuild the server.

---

<div class="post-metadata">

**Author:** ![dakota](https://yyz1.discourse-cdn.com/flex029/user_avatar/discourse.cakephp.org/dakota/32/1421_2.png) [@dakota](https://discourse.cakephp.org/u/dakota)\
**Post date:** [August 17, 2017, 3:54pm UTC](https://discourse.cakephp.org/t/website-invaded/3023/6 "2017-08-17T15:54:34Z")

</div>

> [@grupoviabr](#):
>
> A cakephp 3 crash is not possible right?

Not from CakePHP itself. Hard to say anything more concrete without a full security audit of your code.

> [@grupoviabr](#):
>
> I’m looking for a way to not have to rebuild the server.

Like I’ve said. Once a server has been compromised, the only solution is a full rebuild. You have no way of knowing what else has been installed on the server, and chances are very good that they’ve installed a hard to detect backdoor.
