|
PHP
How can I improve the security on this? |
|
Mysql -> Make sure you always use mysql_real_escape_string for escaping queries or you may get SQLi'd.
Preventing XSS -> strip_tags and htmlentities is always a good start (If you're putting the input back into a html input (input tags) then you will need more protection. That's the basic stuff :).
Jun 25, 2012 06:45 AM
(This post was last modified: Jun 25, 2012 07:52 AM by Phizo.)
(Jun 25, 2012 04:18 AM)Jαmes Wrote: Mysql -> Make sure you always use mysql_real_escape_string for escaping queries or you may get SQLi'd. Pretty much this. If you need some code to look at then here is some of mine: PHP Code Another thing is to use custom error handling functions, such as my report_error() function. This is to prevent disclosure of any useful information that can be obtained by creating a MySQL error. If you are expecting a lot of errors then log them into a table, I have them sent to my email because I don't plan on getting any often. PHP Code ![]()
If you're using the HTTP GET method to perform actions; such as using ?action=delete which would be used to delete something, then use Nonces. If you don't know what they are; they're methods to stop people sending you links, such as: www.site.com/acp.php?id=3&action=delete, which would presumably delete your user if clicked. They do this by preventing actions initiated by links or REQUESTS from being used more than once. Every time a link/form is printed on the screen, your Nonce will embed a key/value pair to be sent to the receiving script. Every time that script is called, it checks for the key/value pair and then authenticates it. If it passes, the action is performed, if it fails, the action is not performed.
You can read up more about these nifty security features here.
PHP internals developer
(Jun 25, 2012 12:19 PM)Haxalot Wrote: If you're using the HTTP GET method to perform actions; such as using ?action=delete which would be used to delete something, then use Nonces. If you don't know what they are; they're methods to stop people sending you links, such as: www.site.com/acp.php?id=3&action=delete, which would presumably delete your user if clicked. They do this by preventing actions initiated by links or REQUESTS from being used more than once. Every time a link/form is printed on the screen, your Nonce will embed a key/value pair to be sent to the receiving script. Every time that script is called, it checks for the key/value pair and then authenticates it. If it passes, the action is performed, if it fails, the action is not performed. So that is just like MyBB's post key? (Jun 25, 2012 02:45 AM)Webman.io Wrote: https://hackforums.net/showthread.php?tid=2564825 Check out this ebook that I wrote a few months back on web application security. It covers basically all the topics and is directed towards PHP. Web Application Security
If you're looking at using a login system which connects to a database may be an idea to start of with no using just MySQL but look into MySQLi or PDO because they offer improvements over other things.
PDO also offers prepare statements which can in a way make more sense when it comes to securing a query. Yet you'll still need to strip any malicious HTML out of anything you plan to display to users.
Jun 26, 2012 03:26 PM
(This post was last modified: Jun 26, 2012 03:28 PM by YERANUK.)
What Haxolot stated, is called CRSF, it's a way of sending commands to a website using your own forms ( only way to make a post request ) or a simple link and tricking others into using them to use their privileges to your own advantage.
Imagine if someone had a Paypal type website, and someone manages to make you click a form that simulates a a transaction on their own website ( but its pointing to the paypal type website ), they could take all your money without having to login to your account. |
|
|
| Possibly Related Threads... | |||
| Thread / Author | Replies | Views | Last Post |
| by Proxy3200Apr 29, 2024 12:34 AM | 8 | 246 |
Apr 29, 2024 12:34 AM Last Post: Finacustech |


![[Image: 8Yoto.png]](https://i.imgur.com/8Yoto.png)