Home  >  Article  >  Backend Development  >  Methods to prevent local users from using fsockopen to carry out DDOS attacks in IIS environment

Methods to prevent local users from using fsockopen to carry out DDOS attacks in IIS environment

WBOY
WBOYOriginal
2016-07-25 09:05:541312browse
  1. /*
  2. from: http://bbs.it-home.org
  3. date: 2013/2/17
  4. */
  5. $fp = fsockopen("udp://$ip ", $rand, $errno, $errstr, 5);
  6. if($fp){
  7. fwrite($fp, $out);
  8. fclose($fp);
  9. ?>
Copy code

In response to this situation, you can modify php.ini, disable the fsockopen function, and use the Windows 2003 security policy to block the local UDP port.

1), disable function Find disable_functions and add the function name to be disabled, as in the following example:

  1. passthru,exec,system,chroot,scandir,chgrp,chown,shell_exec,proc_open,proc_get_status,ini_alter,ini_alter,ini_restore,dl,pfsockopen,openlog,
  2. syslog,readlink,symlink,popepassthru,stream_socket_server,fsocket , fsockopen
Copy the code

and it will take effect after restarting IIS.

2), block UDP port Copy it to Notepad, save it as a bat file with any name, and double-click to run it.

  1. REM Add security policy, name

  2. netsh ipsec static add policy name=My security policy

  3. REM Add IP filter list

  4. netsh ipsec static add filterlist name=allow list
  5. netsh ipsec static add filterlist name=deny list

  6. REM Add filter to IP filter list (allow Internet access)

  7. netsh ipsec static add filter filterlist=allow list srcaddr= me dstaddr=any description=dns access protocol=udp mirrored=yes dstport=53

  8. REM Add filter to IP filter list (not allowing others to access)

  9. netsh ipsec static add filter filterlist=deny List srcaddr=any dstaddr=me description=Others to access me any protocol=udp mirrored=yes

  10. REM Add filter action

  11. netsh ipsec static add filteraction name=Can action=permit
  12. netsh ipsec static add filteraction name=No action=block

  13. @REM http://bbs.it-home.org

  14. REM Creates a link specifying IPSec policy, filter list and rules for filter actions ( Add rules to my security policy)
  15. netsh ipsec static add rule name=allow rule policy=my security policy filterlist=allow list filteraction=ok
  16. netsh ipsec static add rule name=deny rule policy=my security policy filterlist=deny List filteraction=Not possible

  17. REM Activate my security policy

  18. netsh ipsec static set policy name=My security policy assign=y

Copy code


Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Previous article:pdo transactionNext article:pdo transaction