You can reset Magento file & Directory to their default and secure permissions, by following commands from the directory where Magento is installed
find . –type f –exec chmod 644 {} ;
find . –type d –exec chmod 755 {} ;
chmod +x mage