security - Why should I prevent direct access to PHP files that do not echo anything? -
for example if have mail script or script writes database - scripts not echo important (other thank you, or error message), lot of important back-end work.
what possible security concerns accessing them directly be?
is worth preventing direct access such files?
they receiving data using $_post
/$_get
sent trough contact forms , either mailing or writing db (in both cases after validation).
still, can data being worked there accessed somehow (other cracking account , downloading them :)), since opening such files in browser not give results attacker?
server misconfiguration
the security risk is, in case web server fails execute php file (because configuration reset), it's source-code displayed inside browser plain text. , want prevent that.
wrong context
next scenario, problem is, if file database data example, calling file w/o direct output have influence of indirect output. unwanted well.
in case sends email even, direct requests can used send emails. unwanted well.
not mention risks can have in getting stuff penetrated. not place possible, should keep surface small.
improved file-handling
the best approach store applications code outside of webroot, files never accessible direct http request.
Comments
Post a Comment