WEB APPLICATION FortiWeb™ 5.0 Patch 3

Administration Guide

Courtney Schwartz

Contributors: George Csaba Martin Duijm Patricia Siertsema Idan Soen Shiji Li Qin Lu Atsunobu Shiiya Hao Xu Shiqiang Xu Forrest Zhang FortiWeb 5.0 Patch 3 Administration Guide December 1, 2013 3rd Edition Copyright© 2013 Fortinet, Inc. All rights reserved. Fortinet®, FortiGate®, and FortiGuard® are registered trademarks of Fortinet, Inc., and other Fortinet names herein may also be trademarks of Fortinet. All other product or company names may be trademarks of their respective owners. Performance metrics contained herein were attained in internal lab tests under ideal conditions, and performance may vary. Network variables, different network environments and other conditions may affect performance results. Nothing herein represents any binding commitment by Fortinet, and Fortinet disclaims all warranties, whether express or implied, except to the extent Fortinet enters a binding written contract, signed by Fortinet’s General Counsel, with a purchaser that expressly warrants that the identified product will perform according to the performance metrics herein. For absolute clarity, any such warranty will be limited to performance in the same ideal conditions as in Fortinet’s internal lab tests. Fortinet disclaims in full any guarantees. Fortinet reserves the right to change, modify, transfer, or otherwise revise this publication without notice, and the most current version of the publication shall be applicable.

Technical Documentation http://help.fortinet.com Knowledge Base http://kb.fortinet.com Forums https://support.fortinet.com/forum Customer Service & Support https://support.fortinet.com Training http://training.fortinet.com FortiGuard Threat Research & Response http://www.fortiguard.com License http://www.fortinet.com/doc/legal/EULA.pdf Document Feedback Email: [email protected] Table of contents

Introduction...... 13 Benefits...... 13 Architecture ...... 14 Scope...... 14

What’s new...... 16 Documentation enhancements...... 20

Key concepts ...... 21 Workflow...... 21 Sequence of scans ...... 22 Solutions for specific web attacks...... 26 HTTP/HTTPS threats ...... 26 DoS attacks ...... 31 HTTP sessions & security ...... 33 FortiWeb sessions vs. web application sessions ...... 36 Sessions & FortiWeb HA...... 38 Example: Magento & FortiWeb sessions during failover ...... 38 HA heartbeat & synchronization ...... 39 Data that is not synchronized by HA ...... 40 Configuration settings that are not synchronized by HA ...... 41 How HA chooses the active appliance ...... 43 How to use the web UI ...... 44 System requirements...... 44 URL for access ...... 44 Workflow ...... 45 Permissions...... 46 Trusted hosts ...... 50 Maximum concurrent administrator sessions...... 50 Global web UI & CLI settings...... 50 Buttons, menus, & the displays ...... 54 Deleting entries ...... 56 Renaming entries ...... 57 Shutdown...... 57

How to set up your FortiWeb...... 59 Appliance vs. VMware ...... 59 Registering your FortiWeb ...... 59

Fortinet 3 FortiWeb 5.0 Patch 3 Administration Guide Planning the network topology...... 60 How to choose the operation mode ...... 60 Supported features in each operation mode ...... 61 Matching topology with operation mode & HA mode...... 62 Topology for reverse proxy mode...... 62 Topology for either of the transparent modes ...... 64 Topology for offline protection mode ...... 65 Topologies for high availability (HA) clustering ...... 67 Connecting to the web UI or CLI ...... 69 Connecting to the web UI ...... 70 Connecting to the CLI...... 72 Updating the firmware ...... 75 Testing new firmware before installing it ...... 75 Installing firmware...... 77 Updating firmware on an HA pair...... 81 Installing alternate firmware...... 82 Booting from the alternate partition ...... 85 Changing the “admin” account password...... 88 Setting the system time & date...... 89 Setting the operation mode ...... 92 Configuring a high availability (HA) FortiWeb cluster...... 95 Replicating the configuration without FortiWeb HA (external HA) ...... 105 Configuring the network settings...... 109 Network interface or bridge? ...... 109 Configuring the network interfaces...... 111 Adding VLAN subinterfaces ...... 115 Link aggregation ...... 118 Configuring a bridge (V-zone) ...... 120 Adding a gateway ...... 123 Configuring DNS settings ...... 128 Connecting to FortiGuard services...... 132 Choosing the virus signature database & decompression buffer...... 136 Accessing FortiGuard via a web proxy...... 138 How often does Fortinet provide FortiGuard updates for FortiWeb?...... 138 Scheduling automatic signature updates ...... 139 Manually initiating update requests ...... 142 Uploading signature & geography-to-IP updates...... 144 Configuring basic policies ...... 146 Example 1: Configuring a policy for HTTP via auto-learning...... 146 Example 2: Configuring a policy for HTTPS ...... 147 Example 3: Configuring a policy for load balancing ...... 148

Fortinet 4 FortiWeb 5.0 Patch 3 Administration Guide Auto-learning ...... 149 How to adapt auto-learning to dynamic URLs & unusual parameters ...... 149 Configuring URL interpreters ...... 150 Example: URL interpreter for a JSP application ...... 154 Example: URL interpreter for Outlook Web App...... 154 Example: URL interpreter for WordPress...... 158 Grouping URL interpreters...... 163 Recognizing data types ...... 164 Predefined data types...... 164 Grouping predefined data types ...... 168 Recognizing suspicious requests ...... 169 Predefined suspicious request URLs...... 170 Configuring custom suspicious request URLs ...... 171 Grouping custom suspicious request URLs ...... 172 Grouping all suspicious request URLs...... 173 Configuring an auto-learning profile ...... 175 Running auto-learning...... 178 Pausing auto-learning for a URL...... 179 Viewing auto-learning reports...... 180 Using the report navigation pane...... 181 Using the report display pane...... 184 Overview tab ...... 184 Attacks tab ...... 186 About the attack count...... 189 Visits tab...... 189 Parameters tab...... 192 Cookies tab ...... 193 Generating a profile from auto-learning data...... 194 Transitioning out of the auto-learning phase ...... 197 Removing old auto-learning data...... 198 Testing your installation...... 199 Reducing false positives ...... 200 Testing for vulnerabilities & exposure...... 201 Expanding the initial configuration...... 201 Switching out of offline protection mode...... 203

Backups...... 204 Restoring a previous configuration...... 208

Administrators ...... 210 Configuring access profiles ...... 213 Grouping remote authentication queries for administrators...... 214 Changing an administrator’s password...... 215

Fortinet 5 FortiWeb 5.0 Patch 3 Administration Guide Users...... 217 Authentication styles...... 217 Via the “Authorization:” header in the HTTP/HTTPS protocol...... 217 Via forms embedded in the HTML...... 218 Via a personal certificate...... 220 Offloading HTTP authentication & authorization ...... 221 Configuring local end-user accounts...... 223 Configuring queries for remote end-user accounts...... 224 Configuring LDAP queries...... 224 Configuring RADIUS queries...... 229 Configuring NTLM queries ...... 231 Grouping users ...... 232 Applying user groups to an authorization realm ...... 233 Grouping authorization rules...... 236 Single sign-on (SSO)...... 238 Example: Enforcing complex passwords ...... 242

Defining your web servers & load balancers ...... 243 Protected web servers vs. protected/allowed host names ...... 243 Defining your protected/allowed HTTP “Host:” header names ...... 244 Defining your web servers ...... 246 Defining your web server by its IP address ...... 246 Defining your web server by its DNS domain name ...... 248 Configuring server up/down checks...... 249 Grouping your web servers into server farms...... 251 Routing based upon URL or “Host:” name...... 257 Example: Routing according to URL/path ...... 260 Example: Routing according to the HTTP “Host:” field ...... 260 Defining your proxies, clients, & X-headers...... 261 Indicating the original client’s IP to back-end web servers ...... 262 Indicating to back-end web servers that the client’s request was HTTPS.... 264 Blocking the attacker’s IP, not your load balancer...... 264 Configuring virtual servers on your FortiWeb ...... 267 Defining your network services...... 269 Defining custom services...... 269 Predefined services ...... 270 Enabling or disabling traffic forwarding to your servers ...... 270

Secure connections (SSL/TLS) ...... 272 Offloading vs. inspection ...... 272 Supported cipher suites & protocol versions ...... 274 Uploading trusted CAs’ certificates...... 275 Grouping trusted CAs’ certificates ...... 277

Fortinet 6 FortiWeb 5.0 Patch 3 Administration Guide How to offload or inspect HTTPS...... 278 Generating a certificate signing request ...... 280 Uploading a server certificate ...... 284 Supplementing a server certificate with its signing chain...... 286 How to apply PKI client authentication (personal certificates) ...... 288 Example: Generating & downloading a personal certificate from Microsoft Windows 2003 Server ...... 292 Example: Downloading the CA’s certificate from Microsoft Windows 2003 Server ...... 301 Example: Importing the personal certificate & private key to a client’s trust store on Microsoft Windows 7...... 302 Uploading the CA’s certificate to FortiWeb’s trusted CA store...... 310 Configuring FortiWeb to validate client certificates...... 311 Revoking certificates ...... 313 Revoking certificates by OCSP query...... 314 How to export/back up certificates & private keys...... 315

Access control...... 316 Restricting access to specific URLs ...... 316 Grouping access rules per combination of URL & “Host:”...... 319 Combination access control & rate limiting ...... 320 Blacklisting & whitelisting clients...... 324 Blacklisting source IPs with poor reputation ...... 324 Blacklisting countries & regions...... 326 Blacklisting & whitelisting clients individually by source IP ...... 330 Blacklisting content scrapers, search engines, web crawlers, & other robots ..... 332

Rate limiting ...... 333 DoS prevention ...... 333 Configuring application-layer DoS protection ...... 333 Limiting the total HTTP request rate from an IP ...... 334 Example: HTTP request rate limit per IP...... 339 Limiting TCP connections per IP address by session cookie...... 339 Example: TCP connection per session limit ...... 342 Preventing an HTTP request flood...... 342 Example: HTTP request flood prevention ...... 346 Configuring network-layer DoS protection ...... 346 Limiting TCP connections per IP address ...... 346 Example: TCP flood prevention ...... 349 Preventing a TCP SYN flood...... 349 Grouping DoS protection rules ...... 350 Preventing automated requests...... 352 Example: Preventing email directory harvesting...... 355 Configuring browser enforcement exceptions...... 356 Preventing brute force logins...... 357

Fortinet 7 FortiWeb 5.0 Patch 3 Administration Guide Rewriting & redirecting ...... 362 Example: HTTP-to-HTTPS redirect ...... 368 Example: Full host name/URL translation ...... 371 Example: Sanitizing poisoned HTML...... 375 Example: Inserting & deleting body text...... 377 Example: Rewriting URLs using regular expressions ...... 378 Example: Rewriting URLs using variables ...... 379 Grouping rewriting & redirection rules ...... 380

Blocking known attacks & data leaks ...... 382 Configuring action overrides or exceptions to data leak & attack detection signa- tures...... 393 Finding signatures that are disabled or “Alert Only”...... 396 Defining custom data leak & attack signatures ...... 396 Example: ASP .Net version & other multiple server detail leaks...... 401 Example: Zero-day XSS...... 402 Example: Local file inclusion fingerprinting via Joomla ...... 404 Enforcing page order that follows application logic ...... 406 Specifying URLs allowed to initiate sessions ...... 410

Preventing zero-day attacks ...... 416 Validating parameters (“input rules”) ...... 416 Defining custom data types ...... 422 Grouping input rules ...... 423 Preventing tampering with hidden inputs ...... 425 Specifying allowed HTTP methods...... 431 Configuring allowed method exceptions ...... 433 HTTP/HTTPS protocol constraints ...... 435 Configuring HTTP protocol constraint exceptions ...... 441

Limiting file uploads ...... 446 Grouping file upload restrictions...... 448

Compression & decompression...... 451 Configuring compression/decompression exemptions...... 451 Configuring compression offloading...... 452 Configuring decompression to enable scanning & rewriting...... 455

Policies ...... 458 How operation mode affects server policy behavior ...... 458 Configuring the global object white list ...... 459 Uploading a custom error page...... 462 Configuring a protection profile for inline topologies...... 463 Configuring a protection profile for an out-of-band topology or asynchronous mode of operation ...... 472

Fortinet 8 FortiWeb 5.0 Patch 3 Administration Guide Configuring a server policy ...... 478 Enabling or disabling a policy ...... 492

Anti-defacement...... 493 Reverting a defaced web site ...... 498

Compliance ...... 499 Database security ...... 499 Authorization...... 499 Preventing data leaks ...... 499 Vulnerability scans ...... 500 Preparing for the vulnerability scan ...... 501 Live web sites ...... 501 Network accessibility ...... 501 Traffic load & scheduling...... 501 Scheduling web vulnerability scans...... 502 Configuring vulnerability scan settings ...... 503 Running vulnerability scans ...... 508 Manually starting & stopping a vulnerability scan...... 510 Viewing vulnerability scan reports ...... 511 Scan report contents ...... 511 Downloading vulnerability scan reports...... 512

Advanced/optional system settings ...... 514 Changing the FortiWeb appliance’s host name...... 514 Fail-to-wire for power loss/reboots ...... 515 Advanced settings ...... 516 Example: Setting a separate rate limit for shared Internet connections...... 518

Monitoring your system ...... 520 The dashboard...... 520 System Information widget ...... 523 FortiGuard Information widget...... 525 CLI Console widget...... 529 System Resources widget ...... 531 Attack Log Console widget...... 531 Real Time Monitor widget...... 532 Event Log Console widget...... 533 Server Status widget...... 533 Policy Sessions widget ...... 535 Operation widget ...... 535 RAID level & disk statuses ...... 536

Fortinet 9 FortiWeb 5.0 Patch 3 Administration Guide Logging...... 537 About logs & logging...... 538 Log types ...... 538 Log severity levels...... 539 Log rate limits ...... 539 Configuring logging...... 540 Enabling log types, packet payload retention, & resource shortage alerts .... 541 Configuring log destinations ...... 544 Obscuring sensitive data in the logs...... 547 Configuring Syslog settings ...... 549 Configuring FortiAnalyzer policies ...... 550 Configuring triggers ...... 552 Viewing log messages ...... 552 Viewing a single log message as a table ...... 557 Viewing packet payloads ...... 558 Switching between Raw & Formatted log views...... 559 Displaying & arranging log columns...... 561 Filtering log messages ...... 562 Downloading log messages...... 564 Deleting log files...... 566 Coalescing similar attack log messages...... 567 Searching attack logs ...... 568 Alert email ...... 571 Configuring email settings ...... 571 Configuring alert email for event logs ...... 573 SNMP traps & queries ...... 575 Configuring an SNMP community ...... 576 MIB support ...... 581 Reports ...... 581 Customizing the report’s headers, footers, & logo ...... 584 Restricting the report’s scope ...... 585 Choosing the type & format of a report profile ...... 587 Scheduling reports...... 590 Selecting the report’s file type & email delivery...... 590 Viewing & downloading generated reports...... 592 Data analytics ...... 593 Configuring policies to gather data...... 593 Updating data analytics definitions...... 593 Viewing web site statistics ...... 594 Filtering the data analytics report...... 598 Bot analysis...... 600 Monitoring currently blocked IPs...... 601 FortiGuard updates...... 601 Vulnerability scans ...... 602

Fortinet 10 FortiWeb 5.0 Patch 3 Administration Guide Fine-tuning & best practices ...... 603 Hardening security...... 603 Topology ...... 603 Administrator access ...... 604 User access ...... 606 Signatures & patches...... 607 Buffer hardening ...... 607 Enforcing valid, applicable HTTP...... 609 Sanitizing HTML application inputs ...... 609 Improving performance ...... 609 System performance...... 609 Antivirus performance...... 610 Regular expression performance tips...... 610 Logging performance...... 612 Report performance...... 613 Auto-learning performance ...... 614 Vulnerability scan performance ...... 618 Packet capture performance ...... 618 Improving fault tolerance ...... 618 Alerting the SNMP manager when HA switches the primary appliance...... 619 Reducing false positives...... 619 Regular backups...... 623 Downloading logs in RAM before shutdown or reboot ...... 624

Troubleshooting ...... 625 Tools ...... 625 Ping & traceroute ...... 625 Log messages...... 626 Diff...... 627 Packet capture...... 628 Diagnostic commands in the CLI...... 633 How to troubleshoot ...... 633 Establishing a system baseline...... 633 Determining the source of the problem ...... 634 Planning & access privileges ...... 635

Fortinet 11 FortiWeb 5.0 Patch 3 Administration Guide Solutions by issue type...... 635 Connectivity issues ...... 636 Checking hardware connections ...... 636 Examining the ARP table ...... 637 Checking routing...... 637 Testing for connectivity with ping ...... 639 Testing routes & latency with traceroute ...... 643 Examining the routing table ...... 646 Checking port assignments ...... 647 Performing a packet trace...... 647 Debugging the packet processing flow ...... 648 Checking the SSL/TLS handshake & encryption...... 648 Resource issues...... 649 Killing system-intensive processes...... 649 Monitoring traffic load...... 649 Preparing for attacks...... 650 Login issues ...... 650 Checking user authentication policies ...... 650 When an administrator account cannot log in from a specific IP ...... 651 Remote authentication query failures ...... 651 Resetting passwords ...... 651 Data storage issues ...... 652 Bootup issues ...... 653 Hard disk corruption or failure ...... 653 Power supply failure...... 655 Resetting the configuration...... 657 Restoring firmware (“clean install”)...... 658

Appendix A: Port numbers...... 661 Appendix B: Maximum configuration values ...... 664 Maximum values on FortiWeb-VM ...... 664

Appendix C: Supported RFCs, W3C, & IEEE standards...... 666 RFCs ...... 666 W3C standards ...... 666 IEEE standards ...... 667

Appendix D: Regular expressions...... 668 Regular expression syntax...... 668 What are back-references? ...... 673 Cookbook regular expressions...... 675 Language support...... 677

Index ...... 679

Fortinet 12 FortiWeb 5.0 Patch 3 Administration Guide Introduction

Welcome, and thank you for selecting Fortinet products for your network. FortiWeb hardware and FortiWeb-VM virtual appliance models are available that are suitable for medium and large enterprises, as well as service providers.

Benefits

FortiWeb is designed specifically to protect web servers. FortiWeb web application firewalls (WAF) provide specialized application layer threat detection and protection for HTTP or HTTPS services such as: • Apache Tomcat •nginx •Microsoft IIS • JBoss •IBM Lotus Domino • Microsoft SharePoint • Microsoft Outlook Web App (OWA) • RPC and ActiveSync for Microsoft Exchange Server • Joomla •WordPress • and many others FortiWeb’s integrated web-specific vulnerability scanner can drastically reduces challenges associated with protecting regulated and confidential data by detecting your exposure to the latest threats, especially the OWASP Top 10. In addition, FortiWeb’s HTTP firewall and denial-of-service (DoS) attack-prevention protect your Internet-facing web-based applications from attack and data theft. Using advanced techniques to provide bidirectional protection against sophisticated threats like SQL injection and cross-site scripting (XSS), FortiWeb helps you prevent identity theft, financial fraud, and corporate espionage. FortiWeb delivers the technology you need to monitor and enforce government regulations, industry best practices, and internal security policies, including firewalling and patching requirements from PCI DSS. FortiWeb’s application-aware firewalling and load balancing engine can: • Secure HTTP applications that are often gateways into valuable databases • Prevent and reverse defacement • Improve application stability • Monitor servers for downtime & connection load • Reduces response times • Accelerate SSL/TLS * • Accelerate compression/decompression • Rewrite content on the fly

Fortinet 13 FortiWeb 5.0 Patch 3 Administration Guide * On VM models, acceleration is due to offloading the cryptography burden from the back-end server. On hardware models, cryptography is also hardware-accelerated via ASIC chips. FortiWeb significantly reduces deployment costs by consolidating WAF, hardware acceleration, load balancing, and vulnerability scanning into a single device with no per-user pricing. Those features drastically reduce the time required to protect your regulated, Internet-facing data and eases the challenges associated with policy enforcement and regulatory compliance.

Architecture

Figure 1: Basic topology

FortiWeb can be deployed in a one-arm topology, but is more commonly positioned inline to intercept all incoming clients’ connections and redistribute them to your servers. FortiWeb has TCP- and HTTP-specific firewalling capability. Because it is not designed to provide security to non-HTTP applications, it should be deployed behind a firewall such as FortiGate that focuses on security for other protocols that may be forwarded to your back-end servers, such as FTP and SSH. Once the appliance is deployed, you can configure FortiWeb via its web UI and CLI, from a web browser and terminal emulator on your management computer.

Scope

This document describes how to set up your FortiWeb appliance. For both the hardware and virtual appliance versions of FortiWeb, it describes how to complete first-time system deployment, including planning the network topology. It also describes how to use the web user interface (web UI), and contains lists of default utilized port numbers, configuration limits, and supported standards. This document assumes, if you have installed the virtual appliance version (FortiWeb-VM), that you have already followed the instructions in the FortiWeb-VM Install Guide.

Fortinet 14 FortiWeb 5.0 Patch 3 Administration Guide After completing “How to set up your FortiWeb” on page 59: • You will have administrative access to the web UI and/or CLI. • You will have completed firmware updates, if any. • The system time, DNS settings, administrator password, and network interfaces will be configured. • You will have set the operation mode. • You will have configured basic logging. • You will have created at least one server policy. • You may have completed at least one phase of auto-learning to jump-start your configuration. Once that basic installation is complete, you can use the rest of this document to use the web UI to: • Update the FortiWeb appliance. • Reconfigure features. • Use advanced features, such as anti-defacement. • Diagnose problems. This document does not provide a reference for the command line interface (CLI). For that information, see the FortiWeb CLI Reference. This document is intended for administrators, not end users. If you are accessing a web site protected by FortiWeb, please contact your system administrator.

Fortinet 15 FortiWeb 5.0 Patch 3 Administration Guide What’s new

The list below contains features new or changed since FortiWeb 4.0 MR3 Patch 7. For upgrade information, see the Release Notes available with the firmware and “Updating the firmware” on page 75.

FortiWeb 5.0 Patch 3 •No new features. Bug fixes only.

FortiWeb 5.0 Patch 2 • Hidden fields protection for HTTPS — You can now use the Fetch URL dialog in the GUI to help you tamper-proof hidden inputs in HTTPS requests. See “Preventing tampering with hidden inputs” on page 425. • Indicating original service to back-end servers— When offloading SSL/TLS, you can now use an HTTP X-header to indicate to back-end web servers that the original client’s request was, in fact, encrypted. See “Indicating to back-end web servers that the client’s request was HTTPS” on page 264. • More Microsoft file types for file upload restrictions — There are now signatures specifically for Microsoft Office Open XML file types such as .docx. See “Limiting file uploads” on page 446. • Per CPU SNMP queries— You can now monitor the usage of each CPU in multi-CPU appliances. See “MIB support” on page 581. • NMI and COMlog support — FortiWeb 3000D, 3000DFsx, and 4000D models that have NMI buttons now have firmware support. This can be useful for carriers that require extensive debugging capabilities. See your model’s QuickStart Guide and the FortiWeb NMI & COMlog Technical Note. • RAM-only traffic log support — To reduce wear and tear on your hard disks when you require traffic logs, you can now disable hard disk storage of traffic logs and use RAM only. See the FortiWeb CLI Reference.

FortiWeb 5.0 Patch 1 • Site publishing— You can now easily publish Microsoft Outlook Web Access (OWA), SharePoint, Lync and other web applications. FortiWeb streamlines access to the applications by providing offloaded authentication with optional single sign-on (SSO) functionality. See Site Publish and “Single sign-on (SSO)” on page 238. • “Alert Only” action for individual signatures — To provide better flexibility, you can now choose an Alert Only action for individual attack signatures. When configuring a protection profile, save it, then return to it and click the Advanced Mode button. Select a signature category from the menu. When individual signatures appear in the pane on the right, click the signature’s row to select it, then mark the Alert Only check box in the Signature tab. See “Configuring action overrides or exceptions to data leak & attack detection signatures” on page 393. • Attack signature filters — In the Advanced mode while configuring attack signatures, in the bottom of the navigation tree on the left, new categories have been added that display individual signatures that have been disabled, or whose Alert Only check box is marked.

Fortinet 16 FortiWeb 5.0 Patch 3 Administration Guide Previously, the Search item in the tree only enabled you to search for signature IDs. See “Finding signatures that are disabled or “Alert Only”” on page 396. • Custom global white list objects— You can now add your own URLs, parameters, and cookies that you don’t want FortiWeb to inspect. Previously, you could only white list predefined objects. See “Configuring the global object white list” on page 459. • Advanced/combination access control rule enhancement— When configuring HTTP header conditions for combination access control rules, regular expressions are now supported. See “Combination access control & rate limiting” on page 320. • Performance enhancements— Memory utilization and other performance enhancements have been made. For example, the antivirus database now loads into memory only while antivirus is enabled in a policy. • New geo-to-IP database format supported

FortiWeb 5.0

Back up all parts of the configuration and data before updating the firmware to FortiWeb 5.0. Some backup types do not include the full configuration. For full backup instructions, see “Backups” on page 204. FortiWeb 5.0 configuration files are not compatible with previous firmware versions. Many fundamental changes have been made to its configuration file structure. If you later decide to downgrade to FortiWeb 4.4.7 or earlier, your FortiWeb appliance will lose its configuration. To restore the configuration, you will need a backup that is compatible with the older firmware.

• FortiWeb 3000D, 3000DFsx, and 4000D support — All three models support SSL/TLS acceleration with CP8 ASIC chips and have bypass/fail-to-wire port pairs. For hardware details, see your model’s QuickStart Guide and “Fail-to-wire for power loss/reboots” on page 515. For specifications of maximum supported objects, see “Appendix B: Maximum configuration values” on page 664. • Password recovery — If you have forgotten the password, but have physical access to your FortiWeb, you can now reset the password for the admin administrator account. See “Resetting passwords” on page 651. • IPv6 support— If FortiWeb is operating in reverse proxy mode, the following features now support IPv6-to-IPv6 forwarding, as well as NAT64, to support environments where legacy back-end equipment only supports IPv4. • IP/Netmask for all types of network interfaces, DNS settings, and Gateway and Destination IP/Mask for IP-layer static routes • Virtual Server/V-zone • Physical Server/Domain Server/Server Farm • Server Health Check • Protected Servers • Session Management • Cookie Poisoning Detection • Signatures • Custom Access • Parameter Validation • Hidden Fields Protection • File Upload Restriction • HTTP Protocol Constraints

Fortinet 17 FortiWeb 5.0 Patch 3 Administration Guide • Brute Force Login • URL Access • Page Access (page order) • Start Pages • Allow Method • IP List (manual, individual IP blacklisting/whitelisting) • File Compress/File Uncompress • Auto-learning • Vulnerability scans • Global white list objects • Chunk decoding • FortiGuard server IP overrides These are not yet supported:

If a policy has any virtual servers, server farms, physical servers, or domain servers with IPv6 addresses, it will not apply these features, even if they are selected.

• X-Forwarded-For • Shared IP • Policy bypasses for known search engines • Geo IP • DoS Protection • IP Reputation • URL Rewriting (also redirection) • HTTP Authentication and LDAP, RADIUS, and NTLM profiles • Data Analytics • Log-based reports • Alert email • Syslog and FortiAnalyzer IP addresses •NTP • FTP immediate/scheduled • OCSP/SCEP •Anti-defacement • HA/Configuration sync • exec restore • exec backup • exec traceroute • exec telnet • Challenge action for application-level anti-DoS — Rather than simply blocking all clients that exceed your rate limit or trigger other DoS sensors, you can now choose to test the client first — to return a web page that uses a script to assess whether the client is a web browser or an automated tool favored by attackers. In this way, you can allow higher rate

Fortinet 18 FortiWeb 5.0 Patch 3 Administration Guide limits for people than automated tools. See “Limiting the total HTTP request rate from an IP” on page 334 and “Preventing an HTTP request flood” on page 342. • Search engine access improved — You can now allow known search engines such as Google, Yahoo!, Baidu and Bing to be exempt from DoS sensors, brute force login sensors, HTTP protocol constraints, and combination rate & access control (called “advanced protection” and “custom policies” in the web UI). See Allow Known Search Engines in “Configuring a protection profile for inline topologies” on page 463 or “Configuring a protection profile for an out-of-band topology or asynchronous mode of operation” on page 472. • Robot control simplified — Control of known malicious automated tools has been simplified, and custom robot definitions removed. See Bad Robot in “Blocking known attacks & data leaks” on page 382. • Robot monitoring report — To monitor search engines that may be abusing access, you can monitor throughput and transactions per second for each crawler from your GUI’s reports area. See “Bot analysis” on page 600. • Dynamic rate threshold in Real Time Monitor widget — The Policy Summary widget has been renamed, and now scales its graph dynamically to best show you differences based upon your normal levels of traffic. See “Real Time Monitor widget” on page 532. • HTTP status code customization — To prevent WAF fingerprinting that can be a precursor for evasive APT attackers, you can now modify the return codes such as 200 OK that FortiWeb returns to clients when blocking violation traffic. See Error Page Return Code in “Configuring a server policy” on page 478. • Seamless FortiWeb-VM vCPU license upgrades— Now you can increase the capacity of FortiWeb-VM to 2, 4, or 8 vCPUs without first invalidating the license. Previously, a new license could be uploaded only while the current license was invalid, thereby temporarily interrupting service. See the FortiWeb-VM Install Guide. • Maximum physical servers increased — FortiWeb now supports up to 255 physical servers. Previously only 128 were possible. See “Defining your web server by its IP address” on page 246. • Maximum input validation rules increased — FortiWeb now supports up to 1,024 parameters in the URL validation rule. See “Validating parameters (“input rules”)” on page 416. • Erasure without alerts — A very high volume of attack logs, alert email, and that can be generated while blocking information disclosure when many protected web servers are misconfigured. To prevent this and allow you to focus on severe attacks, you can now choose to erase server information such as X-Powered-By: without generating any log messages. See Action in “Blocking known attacks & data leaks” on page 382. • Support for subnets in URL access rules & manual blacklists/white lists— When specifying which source IP addresses are allowed to access your web apps, you can now specify multiple IP addresses by entering a subnet, rather than creating many individual rules. See “Restricting access to specific URLs” on page 316 and “Blacklisting & whitelisting clients individually by source IP” on page 330. • RADIUS realm support— RADIUS accounts on servers that require the realm (e.g. [email protected] or [email protected]) are now supported. No change to the

Fortinet 19 FortiWeb 5.0 Patch 3 Administration Guide FortiWeb configuration is required for end-user accounts. For administrators, modify the Administrator setting to include the realm name (e.g. @example.com). • Fail-to-wire during reboot/shutdown— Previously, fail-to-wire only engaged during unexpected power loss, without a graceful shutdown. See “Fail-to-wire for power loss/reboots” on page 515. • Threshold for shared IPs configurable — Previously, shared IP analysis was not configurable. See “Shared IP” on page 517. • Reports like FortiGate 5.0 — Reports have been updated, and now reflect the same styles also found in FortiGate 5.0 firewalls. See “Reports” on page 581. • Debugging commands on HA standby — You can now use the active FortiWeb HA appliance’s CLI to send diagnose debug commands through the HA link to the standby. Previously, you could only connect to standby appliances through the local console, or by triggering a failover so that the standby became active — network connectivity was only possible with the active appliance. See the FortiWeb CLI Reference. • XML protection profiles removed — For protection against XML-related attacks, customers should now use the Illegal XML Format setting (see “Configuring a protection profile for inline topologies” on page 463 or “Configuring a protection profile for an out-of-band topology or asynchronous mode of operation” on page 472). Legacy configuration data related to XML protection profiles from FortiWeb 4.0 MR4 Patch 6 or previous versions of the firmware will be deleted during upgrade.

If your back-end web servers require extensive protection for a vulnerable XML parser, you should add 3rd-party XML protection to your security architecture. Unlike XML protection profiles in previous versions of FortiWeb, Illegal XML Format does not scan for conformity with the document object model (DOM)/DTD/W3C Schema, recursive payloads, Schema poisoning, or other advanced XML attacks. Failure to provide adequate XML protection could allow attackers to penetrate your network.

• Static routes moved— It is now located under the System > Network menu. See “Adding a gateway” on page 123. • FortiGuard updates moved— It is now located under the System > Config menu, similar to FortiGate 5.0. Configuration of the antivirus database has also moved. See “Choosing the virus signature database & decompression buffer” on page 136. • LDAP, RADIUS, NTLM profiles moved— They are now located under the new User > Remote Server menu to make obvious the dichotomy versus local authentication. See “Grouping remote authentication queries for administrators” on page 214 and “Configuring queries for remote end-user accounts” on page 224. • Anti-defacement moved— It is now located under the Web Protection menu. See “Anti-defacement” on page 493.

Documentation enhancements

Nested configuration items’ instructions(e.g. rules within policies within other policies) are now consolidated within the same section where possible. See “Preventing zero-day attacks” on page 416 and others.

Fortinet 20 FortiWeb 5.0 Patch 3 Administration Guide Key concepts

This chapter defines basic FortiWeb concepts and terms. If you are new to FortiWeb, or new to security, this chapter can help you to quickly understand.

See also • Appliance vs. VMware

Workflow

Begin with “How to set up your FortiWeb” on page 59 for your initial deployment. These instructions will guide you to the point where you have a simple, verifiably working installation. Ongoing use is located in the chapters after “How to set up your FortiWeb”. Once you have successfully deployed, ongoing use involves: • Backups • Updates • Configuring optional features • Adjusting policies if: • New attack signatures become available • Requirements change • Fine-tuning performance • Periodic web vulnerability scans if required by your compliance regime • Monitoring for defacement or focused, innovative attack attempts from advanced persistent threats (APTs) • Monitoring for accidentally blacklisted client IPs • Using data analytics to show traffic patterns

Fortinet 21 FortiWeb 5.0 Patch 3 Administration Guide Except for features independent of policies such as anti-defacement, most features are configured before policies. Policies link protection components together and apply them. As such, policies usually should be configured last, not first.

Sequence of scans

FortiWeb appliances apply protection rules and perform protection profile scans in the following order of execution, which varies by whether you have applied a web protection profile. To understand the scan sequence, read from the top of the table (the first scan/action) towards the bottom (the last scan/action). Disabled scans are skipped.

To improve performance, block attackers using the earliest possible technique in the execution sequence and/or the least memory-consuming technique.

The blocking style varies by feature and configuration. For example, when detecting cookie poisoning, instead of resetting the TCP connection or blocking the HTTP request, you could log and remove the offending cookie. For details, see each specific feature.

Table 1: Execution sequence (web protection profile)

Scan/action Involves

Request from client to server

TCP Connection Number Limit Source IP address of the client (depending on your configuration of X-header rules (see “Defining your (TCP Flood Prevention) proxies, clients, & X-headers” on page 261) this could be derived from either the SRC field in the IP header, or an HTTP header such as X-Forwarded-For: or X-Real-IP:)

Fortinet 22 FortiWeb 5.0 Patch 3 Administration Guide Table 1: Execution sequence (web protection profile)

Scan/action Involves

Block Period Source IP address of the client (depending on your configuration of X-header rules (see “Defining your proxies, clients, & X-headers” on page 261) this could be derived from either the SRC field in the IP header, or an HTTP header such as X-Forwarded-For: or X-Real-IP:)

IP List * Source IP address of the client in the IP layer (individual client IP black list or white list)

Add X-Forwarded-For: Source IP address of the client in the HTTP layer Add X-Real-IP:

IP Reputation Source IP address of the client (depending on your configuration of X-header rules (see “Defining your proxies, clients, & X-headers” on page 261) this could be derived from either the SRC field in the IP header, or an HTTP header such as X-Forwarded-For: or X-Real-IP:)

Allow Known Search Engines Source IP address of the client in the IP layer

Geo IP Source IP address of the client in the IP layer

Host Host: (allowed/protected host name)

Allow Method • Host: • URL in HTTP header • Request method in HTTP header

HTTP Request Limit/sec • Cookie: • Session state • Responses from the JavaScript browser tests, if any

Session Management • Cookie: • Session state

TCP Connection Number Limit Source IP address of the client (depending on your configuration of X-header rules (see “Defining your (Malicious IP) proxies, clients, & X-headers” on page 261) this could be derived from either the SRC field in the IP header, or an HTTP header such as X-Forwarded-For: or X-Real-IP:)

HTTP Request Limit/sec • Cookie: (HTTP Flood Prevention) • Session state • URL in the HTTP header

Fortinet 23 FortiWeb 5.0 Patch 3 Administration Guide Table 1: Execution sequence (web protection profile)

Scan/action Involves

HTTP Request Limit/sec • ID field of the IP header (Standalone IP) •Source IP address of the client (depending on your or configuration of X-header rules (see “Defining your proxies, clients, & X-headers” on page 261) this could HTTP Request Limit/sec (Shared be derived from either the SRC field in the IP header, or IP) an HTTP header such as X-Forwarded-For: or (HTTP Access Limit) X-Real-IP:)

HTTP Authentication Authorization:

Global White List • Cookie: cookiesession1 •URL if /favicon.ico, AJAX URL parameters such as __LASTFOCUS, and others as updated by the FortiGuard Security Service

URL Access • Host: • URL in HTTP header • Source IP of the client in the IP header

Brute Force Login • Source IP address of the client (depending on your configuration of X-header rules (see “Defining your proxies, clients, & X-headers” on page 261) this could be derived from either the SRC field in the IP header, or an HTTP header such as X-Forwarded-For: or X-Real-IP:) • URL in the HTTP header

HTTP Protocol Constraints • Content-Length: • Parameter length • Body length • Header length • Header line length •Count of Range: header lines • Count of cookies

Cookie Poisoning Detection Cookie:

Start Pages • Host: • URL in HTTP header • Session state

Page Access • Host: (page order) • URL in HTTP header • Session state

File Upload Restriction • Content-Length: • Content-Type: in PUT and POST requests

Fortinet 24 FortiWeb 5.0 Patch 3 Administration Guide Table 1: Execution sequence (web protection profile)

Scan/action Involves

Trojans HTTP body

Bad Robot User-Agent:

Parameter Validation • Host: • URL in the HTTP header • Name, data type, and length of tags except

Cross Site Scripting, SQL • Cookie: Injection, Generic Attacks • Parameters in the URL in the HTTP header, or in the (attack signatures) HTTP body (depending on the HTTP method) for tags except • XML content in the HTTP body (if Enable XML Protocol Detection is enabled)

Hidden Fields Protection • Host: • URL in the HTTP header • Name, data type, and length of

X-Forwarded-For X-Forwarded-For: in HTTP header

URL Rewriting • Host: (rewriting & redirects) • Referer: • Location: • URL in HTTP header • HTTP body

Auto-learning Any of the other features included by the auto-learning profile

Data Analytics • Source IP address of the client • URL in the HTTP header • Results from other scans

Client Certificate Forwarding Client’s personal certificate, if any, supplied during the SSL/TLS handshake

Reply from server to client

Information Disclosure Server-identifying custom HTTP headers such as Server: and X-Powered-By:

Credit Card Detection Credit card number in the body, and, if configured, Credit Card Detection Threshold

File Uncompress Content-Encoding:

Fortinet 25 FortiWeb 5.0 Patch 3 Administration Guide Table 1: Execution sequence (web protection profile)

Scan/action Involves

URL Rewriting • Host: (rewriting) • Referer: • Location: • URL in HTTP header • HTTP body

File Compress Accept-Encoding:

* If a source IP is white listed, subsequent checks will be skipped.

Solutions for specific web attacks

The types of attacks that web servers are vulnerable to are varied, and evolve as attackers try new strategies. FortiWeb appliances offer numerous configurable features for preventing web-related attacks, including denial-of-service (DoS) assaults, brute-force logins, data theft, and more.

Early in your deployment of FortiWeb, configure and run web vulnerability scans to detect the most common attack vulnerabilities. You can use this to discover attacks that you may be vulnerable to. For more information, see “Vulnerability scans” on page 500.

HTTP/HTTPS threats

Servers are increasingly being targeted by exploits at the application layer or higher. These attacks use HTTP/HTTPS and aim to compromise the target web server, either to steal information, deface it, or to post malicious files on a trusted site to further exploit visitors to the site, using the web server to create botnets. Among its many threat management features, FortiWeb’s fends off attacks that use cross-site scripting, state-based, and various injection attacks. This helps you comply with protection standards for: • credit-card data, such as PCI DSS 6.6 • personally identifiable information, such as HIPAA Table 2 lists several HTTP-related threats and describes how FortiWeb appliances protect servers from them. FortiWeb can also protect against threats at higher layers (HTML, Flash or XML applications).

Fortinet 26 FortiWeb 5.0 Patch 3 Administration Guide

Table 2: Web-related threats

Attack Description Protection FortiWeb Solution Technique

Adobe Flash Attackers attempt XSS, SQL Decode and scan Flash Enable AMF3 binary injection or other common action message format Protocol Detection (AMF) exploits through an Adobe Flash (AMF) binary data for protocol client. matches with attack attacks signatures.

Botnet Utilizes zombies previously Decode and scan Flash IP Reputation exploited or infected (or willingly action message format participating), distributed usually (AMF) binary data for globally, to simultaneously matches with attack overwhelm the target when signatures. directed by the command and control server(s).

Browser A man-in-the-middle attack • Use TLS 1.1 or Prioritize RC4 Exploit where an eavesdropper exploits greater, or Cipher Suite Against reused initialization vectors in • Use ciphers that do SSL/TLS older TLS 1.0 implementations of not involve CBC, (BEAST) CBC-based encryption ciphers such as stream such as AES and 3DES. ciphers, or • Use CBC only with correct initialization vector (IV) implementations

Brute force An attacker attempts to gain Require strong Brute Force Login login attack authorization by repeatedly trying passwords for users, ID and password combinations and throttle login until one works. attempts.

Clickjacking Code such as into a null string to delete it from the infected web server’s response. FortiWeb will replace the attack with its own content: "> The second one exploits the nature of all web pages with images and other external files. Other than the web page itself, all images, scripts, styles, media, and objects cause the web browser to make secondary HTTP requests: one for each component of the web page. Here, the tag causes the client’s web browser to make a request that is actually an injection attempt on another web site. The incident response team has written 3 regular expressions to detect each of the above XSS attack classes, as well as similar permutations that use HTML tags other than : • <(.*)src(\s)*=(\s)*[‘’‘”](\s)*(.*)(\s)*[‘’‘”](\s)*onError • <(.*)[‘’‘”][‘’‘”]*(.*)>(\s)*