Go Back   CodingForums.com > :: Server side development > PHP

Before you post, read our: Rules & Posting Guidelines

Reply
 
Thread Tools Rating: Thread Rating: 2 votes, 4.50 average.
Enjoy an ad free experience by logging in. Not a member yet? Register.
Old 03-11-2010, 05:02 PM   PM User | #16
tomws
Senior Coder

 
tomws's Avatar
 
Join Date: Nov 2007
Location: Arkansas
Posts: 2,644
Thanks: 29
Thanked 330 Times in 326 Posts
tomws will become famous soon enoughtomws will become famous soon enough
Are you vulnerable to file inclusion exploits?

Useful read for those who blindly include from the GET string.

http://blogs.sans.org/appsecstreetfi...ile-inclusion/
__________________
Are you a Help Vampire?
tomws is offline   Reply With Quote
Old 07-12-2010, 08:32 AM   PM User | #17
immediate
New Coder

 
Join Date: May 2010
Location: kavoir.com
Posts: 13
Thanks: 0
Thanked 0 Times in 0 Posts
immediate is on a distinguished road
Sorry for digging up the thread, but I believe here's a much better PHP / web security checklist.
immediate is offline   Reply With Quote
Old 08-09-2010, 07:25 PM   PM User | #18
johnnnn
New Coder

 
Join Date: May 2009
Location: Pennsylvania, United States
Posts: 54
Thanks: 16
Thanked 0 Times in 0 Posts
johnnnn is an unknown quantity at this point
Jem is a self-proclaimed l33t PHP ninja, and she knows what she's talking about. :P

Keep an eye on her website, she's very helpful on the subject and has many posts concerning it.

My list:

1. Only use error_reporting(E_ALL) while developing, in the release use error_reporting(0)
2. Don't be afraid to ask questions and get help
3. Report ANY errors/warnings
4. Never trust $_SERVER as it can be modified
5. Never trust anybody
6. The PHP manual can be very useful; don't be afraid, it's your friend.
7. Have people test your projects
8. XSS/CSRF etc attacks
9. Sanitize any user input (Forms, Get, Post, etc..)
10. Be especially careful if you use HTML selects, checkboxes, or radio buttons in forms, they can be changed by the user
11. Time and patients can make the biggest difference
12. You should probably make sure you're comfortable with any language you write a script/program in.
13. Lean by example -- look at other people's script.
14. Try to "break" the script on test runs
15. Password encryption
16. Never store sensitive stuff in .inc.php files
17. Place all config files, .ht* files out of your root directory
18. Ask questions: What could I have done differently? Why does X do this? Why does Y do that.

Sorry if the wording of these tips is a bit odd. :P

Kinda posted this in a hurry!

Last edited by johnnnn; 08-09-2010 at 11:17 PM..
johnnnn is offline   Reply With Quote
Old 05-24-2011, 11:58 AM   PM User | #19
gillianreynolds
New to the CF scene

 
Join Date: May 2011
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
gillianreynolds is an unknown quantity at this point
To add to this, don't forget that % and _ are both special characters in SQL. It is, however, much safer (harder to make mistakes) to limit input to the characters you want (e.g. [a-zA-Z0-9]) than to hope that you have a complete list of all SQL special characters.

IPTables can limit the number of connections an IP address can make in a given time limit and will simply drop packets until the IP address is below the limit again. You can also limit IP addresses by bandwidth in a given time limit. I'm sure other firewalls will have similar capabilities. Filtering such as this should be done as early as possible in the path through your system as that is where it has already had the least impact on the other users of your system.

I don't have a problem with calling your super user "root" but there is no harm in changing it. You should, however, definitely not allow this user to log in over the network. If the root user can log in over the network then an attacker brute forcing his way in already knows one username (and it's the most powerful user to boot)

Strangely enough, this post is almost not about PHP at all, but security involves the entire system so we shouldn't just focus on PHP anyway.

Thanks for the tips.
gillianreynolds is offline   Reply With Quote
Old 11-23-2011, 09:35 AM   PM User | #20
XterM
New Coder

 
Join Date: Jul 2011
Location: Kediri - Indonesia
Posts: 61
Thanks: 2
Thanked 19 Times in 19 Posts
XterM is an unknown quantity at this point
hey, this is nice post.

i have a simple way to prevent sql injection attact. usually, hacker test if sql vulnerable by adding a single or doble quote in input variable. like this:

?id=1' or ?id=1"

so, i remove any quote in all variable. i use str_replace().

i see why hacker do to attack sqlinjection vulnerability. like this:

?id=1+order+by+1--
?id=1+union+select+1,2,3--

so, i remove the +,-,%20,*.

i feel this is just little trick, but this so helpfull to prevent sql injection attact :-)
__________________
I am sorry my english is very bad. But I am very interest to discusse here :-)
XterM is offline   Reply With Quote
Old 11-13-2012, 04:21 PM   PM User | #21
nani_nisha06
Regular Coder

 
Join Date: Oct 2012
Location: mother land --india
Posts: 159
Thanks: 37
Thanked 2 Times in 2 Posts
nani_nisha06 is an unknown quantity at this point
Lovely tut....This type of sticky notes can help beginners like me......

Regards,
nani

Last edited by VIPStephan; 01-31-2013 at 07:59 PM.. Reason: removed huge quote
nani_nisha06 is offline   Reply With Quote
Old 12-24-2012, 08:36 AM   PM User | #22
rajdeep01
New Coder

 
Join Date: Dec 2012
Posts: 20
Thanks: 0
Thanked 0 Times in 0 Posts
rajdeep01 can only hope to improve
I understand what you mean and a very good idea. Apart from the usual stuff like using a firewall, no telnet or FTP it would be good to compile a LAMP based check list to secure these things in a production environment.
rajdeep01 is offline   Reply With Quote
Old 04-01-2013, 02:07 PM   PM User | #23
annaharris
New Coder

 
Join Date: May 2012
Location: USA
Posts: 92
Thanks: 0
Thanked 6 Times in 6 Posts
annaharris can only hope to improve
Regarding pHP guidelines checklist

The checklist that you have mentioned in your thread is very important as per a PHP programmer's point of view.
annaharris is offline   Reply With Quote
Old 04-01-2013, 02:15 PM   PM User | #24
annaharris
New Coder

 
Join Date: May 2012
Location: USA
Posts: 92
Thanks: 0
Thanked 6 Times in 6 Posts
annaharris can only hope to improve
Regarding PHP Code

These are some of the finest resources mentioned in your thread for learning PHP language.
annaharris is offline   Reply With Quote
Reply

Bookmarks

Jump To Top of Thread


Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +1. The time now is 11:44 PM.


Advertisement
Log in to turn off these ads.