If you need to set 777 permissions in your Prestashop for it to work correctly, what you need to do is configure htaccess in those directories. This will greatly limit what can be done in them.
Some of the rules you can specify are as follows:
AddType text/plain .pl
AddType text/plain .cgi
AddType text/plain .php
These three lines prevent files with the .pl, .cgi and .php extensions from being executed and instead display them simply as text in the browser. This helps prevent potentially dangerous scripts from being executed from your server.
<Files ~ "^.ht">
Order allow,deny
Deny from all
Satisfy All
</Files>
This prevents the htaccess file from being viewed/loaded externally, securing the file. You should also bear in mind that htaccess must never have Apache's user or group ( normally www-data ) as its owner, or 777 permissions, as this would allow it to be modified, nullifying its protection.
We must warn you that maintaining and protecting a CMS is quite complicated, especially with 777 directories, so you should keep the number of directories/files with full permissions to a minimum and always keep them protected/monitored as closely as possible.