Prevent execution of certain codes

Discussion in 'PHP' started by born2hack, Jun 8, 2008.

  1. #1
    I am currently making an inbuilt Mail system for y website. What it does is whenever someone send a mail it stores in the db with the id of the user it is being sent to. Then when the other user opens it inbox it can see the mail sent to it. The problem is when the user reads the e-mail, and if the e-mail contains some PHP code for RFI. The site can be easily hacked. Any solutions? I read a post using preg_replace to remove <a></a> tags I think it can be done with <?php ?> tags or <script></script> tags too.

    Thanks
     
    born2hack, Jun 8, 2008 IP
  2. Lordo

    Lordo Well-Known Member

    Messages:
    2,082
    Likes Received:
    58
    Best Answers:
    0
    Trophy Points:
    190
    #2
    Did you try it for yourself and found that PHP code gets executed?
     
    Lordo, Jun 8, 2008 IP
  3. Kynlem

    Kynlem Peon

    Messages:
    14
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #3
    If you don't want any HTML to proceed as well, use htmlentities().
     
    Kynlem, Jun 9, 2008 IP
  4. born2hack

    born2hack Banned

    Messages:
    294
    Likes Received:
    4
    Best Answers:
    0
    Trophy Points:
    0
    #4
    Well Lordo, I dont need to, that was the vulnerability used by me to hack my first web site :|

    And Kynlem a bit more explanation?
     
    born2hack, Jun 9, 2008 IP
  5. Lordo

    Lordo Well-Known Member

    Messages:
    2,082
    Likes Received:
    58
    Best Answers:
    0
    Trophy Points:
    190
    #5
    I am asking about this because I think it is related to some hosting settings (in PHP or apache). When
    I try that, it does not het executed!

    Can you give me an example or PM me a URL to try that?
     
    Lordo, Jun 9, 2008 IP
  6. born2hack

    born2hack Banned

    Messages:
    294
    Likes Received:
    4
    Best Answers:
    0
    Trophy Points:
    0
    #6
    nvrmnd fixed
     
    born2hack, Jun 9, 2008 IP
  7. Lordo

    Lordo Well-Known Member

    Messages:
    2,082
    Likes Received:
    58
    Best Answers:
    0
    Trophy Points:
    190
    #7
    What did you do? :)
     
    Lordo, Jun 9, 2008 IP
  8. born2hack

    born2hack Banned

    Messages:
    294
    Likes Received:
    4
    Best Answers:
    0
    Trophy Points:
    0
    #8
    well I was trying in my localhost. I put it up on my hosting and worked :D u were right.
     
    born2hack, Jun 9, 2008 IP
  9. Lordo

    Lordo Well-Known Member

    Messages:
    2,082
    Likes Received:
    58
    Best Answers:
    0
    Trophy Points:
    190
    #9
    lol I told you :)
    But you need to protect your localhost now! Someone called born2hack is using it :)
     
    Lordo, Jun 9, 2008 IP
  10. born2hack

    born2hack Banned

    Messages:
    294
    Likes Received:
    4
    Best Answers:
    0
    Trophy Points:
    0
    #10
    lol born2hack i guess its me.
     
    born2hack, Jun 9, 2008 IP