开发者

Security risks and appropriate measures while using PHP for taking database dumps/backups of remote databases

Of course there is possibility of script timeout exceeding etc. (unless set accordingly) when using PHP for taking database backups/dumps. But ignoring these non-security related things what are all the security issues involved.

I read somewhere that since the backup needs to be created in the web space, there are risks of the file getting accessed from browser by other users. Can someone explain that in detail? Is there a momentary risk when the dump is created, before proper file permission is set? If so, how do apps like PhpMyAdmin take care of that? I read that they do something but I am not sure what and I found it quite painful to explore its code to locate the trick without knowing what exactly they do. So, if you guys could share the basic idea/technique to start with. Other than this what other security issues exist. It would be nice to see all the possibilities discussed here, so that newbie programmers are aware before running into trouble.

Of course it is better to use things like shell scripts but this may not serve the purpose always -

  • User may not be a techie and be more comfortable with running a simple URL开发者_开发技巧 for backup.
  • There may not be shell access available etc.

    Thanks,

    Sandeepan


Re phpMyAdmin's export process: I think - this is not authoritative, but I'm fairly sure this is how it works - that phpMyAdmin never actually creates a file, but passes through the dump's results directly. So there never is a URL under which the dump could be reached by anybody else except the user who requested it. It all takes place within the memory the script occupies while it runs.

If you can do it that way (send data only directly to the authenticated user) you will be fine. What is indeed potentially dangerous is storing temporary, unprotected files in the web root. That should never be a part of the backup process.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜