Fortinet Fortiweb Lab Guide For Fortiweb 64
Fortinet Fortiweb Lab Guide For Fortiweb 64
© FORTINET
FortiWeb
Lab Guide
for FortiWeb 6.4
DO NOT REPRINT
© FORTINET
Fortinet Training
https://training.fortinet.com
https://docs.fortinet.com
https://kb.fortinet.com
https://fusecommunity.fortinet.com/home
Fortinet Forums
https://forum.fortinet.com
Fortinet Support
https://support.fortinet.com
FortiGuard Labs
https://www.fortiguard.com
https://training.fortinet.com/local/staticpage/view.php?page=certifications
https://home.pearsonvue.com/fortinet
Feedback
Email: [email protected]
1/19/2022
DO NOT REPRINT
© FORTINET
TABLE OF CONTENTS
Change Log 6
Network Topology 7
Lab 1: Initial Setup 8
Exercise 1: Configuring FortiWeb 9
Verify Basic Networking 9
Verify IP Connectivity 9
Configure FortiWeb Basic Settings 9
Exercise 2: Configuring Local Logging 11
Configure Local Logging 11
Lab 2: Basic Configuration 13
Exercise 1: Configuring Traffic Flow to the Web Servers Through FortiWeb 14
Verify Connectivity to the Web Servers 14
Configure a Virtual Server Pool for Web Servers 14
Insert a Persistent Cookie 15
Add a Health Check 16
Define the Web Servers 16
Configure FortiWeb Server Policies 17
Test the Virtual Server 18
Exercise 2: Configuring FortiGate Source NAT 20
Configure the FortiGate Virtual and Real Servers 20
Apply the Load Balancer 21
Test the FortiGate Virtual Server 22
Exercise 3: Configuring the Transmission of the X-Forwarded-For Header 24
Configure FortiWeb to Use X-Headers 24
Define a Group of Signatures 25
Test FortiWeb X-Headers 26
Exercise 4: Content Routing 28
Create a Content Routing Policy 28
Test the Content Routing Policy 31
Lab 3: Web Vulnerability Scanner 33
Exercise 1: Configuring the Web Vulnerability Scanner 34
Perform a Web Vulnerability Scan 34
Create and Run a Custom Scan 35
DO NOT REPRINT
© FORTINET
Exercise 2: Configuring HTTP Rewrite Rules 37
Create HTTP Rewrite Rules 37
Test HTTP Header Removal 38
Lab 4: Authentication and Access Control 40
Exercise 1: Configuring Advanced Access Control 42
Configure Web Protection Rules 42
Apply the Web Protection Rules 43
Test Access Control 44
Exercise 2: Enabling User Tracking 46
Configure User Tracking Rules 46
Create User Tracking Policies 47
Test User Tracking 47
Exercise 3: Configuring Web Authentication 49
Define Host Names and Users 49
Enable HTTP Authentication 51
Test the HTTP Authentication 52
Lab 5: Signature Configuration 54
Exercise 1: Blocking Common Attacks With Signatures 55
Attempt an XSS Attack 55
Attempt a SQL Injection Attack 55
Exercise 2: Blocking With Custom Signatures 57
Block Custom Attacks With FortiWeb 57
Test the Custom Signature 58
Lab 6: DoS Attack Mitigation 60
Exercise 1: Protecting Against a Slow Headers DoS Vulnerability 61
Configure the Server Policy 61
Test for a Slow Headers DoS Vulnerability 61
Distinguish Clients 64
Detect an Excessive Number of TCP Connections 64
Test TCP Floods Protection 65
Exercise 2: Protecting Against Defacement 68
Enable Defacement Detection 68
Deface a Website 69
Lab 7: Machine Learning 70
Exercise 1: Configuring Machine Learning Anomaly Detection 72
Configure the Server Policy 72
Configure Sample Limits 73
Exercise 2: Establishing the Model 74
Train FortiWeb 74
View the Learning Results 75
Generate an Anomaly 76
DO NOT REPRINT
© FORTINET
Exercise 3: Stopping Threats 78
Observe Machine Learning in Action 78
Review the Logs 79
Observe Application Changes 80
Review the Distribution of Anomalies 82
Lab 8: SSL/TLS 84
Exercise 1: Uploading a Server Certificate and Private Key 85
Upload the Server Certificate and Key to FortiWeb 85
Download Backup Files 86
Exercise 2: Implementing SSL/TLS 89
Offload HTTPS to FortiWeb 89
Test the HTTPS Offload 89
Lab 9: Application Delivery 92
Lab 10: Bot Mitigation 93
Exercise 1: Configuring Bot Mitigation 94
Configure FortiWeb Bot Mitigation 94
Test Bot Mitigation Protection 95
Lab 11: Additional Configuration 97
Lab 12: Troubleshooting 98
Exercise 1: Establishing a Baseline 99
Determine Baselines and Normal Use 99
Exercise 2: Mitigating False Positives 101
Reduce False Positives 101
DO Change
NOTLogREPRINT
© FORTINET
Change Log
This table includes updates to the NSE 6 FortiWeb 6.4 document dated 1/5/2022 to the updated document version
dated 1/19/2022.
Change Location
This lab will familiarize you with the FortiWeb GUI and CLI, and guide you through configuring the network
interfaces. It will also guide you through establishing traffic flow through FortiWeb and configuring local logging.
Objectives
l Configure FortiWeb network interfaces and a default route for administrative access through your lab network, using
a browser or SSH client
l Access the GUI
l Verify connectivity to the web servers
l Configure FortiWeb in reverse proxy mode
l Configure local logging
Time to Complete
Estimated: 20 minutes
Verify IP Connectivity
You will verify that FortiWeb can connect to the Student-Linux VM, FortiGate, and two web servers. You will also
verify that the Student-Linux VM can connect to FortiWeb and FortiGate.
To verify IP connectivity
1. Continuing on the FortiWeb SSH session, enter the following commands:
execute ping 100.64.0.10
execute ping 10.0.1.254
execute ping 10.0.1.21
execute ping 10.0.1.22
2. On the Student-Linux VM, open a terminal window, and then enter the following commands:
ping 10.0.1.7
ping 100.64.0.254
ping 10.0.1.21
ping 10.0.1.22
After you configure the network interfaces, you can use your browser to connect to the GUI (or CLI).
Alternatively, after you have access to FortiWeb through the network, you can upload configuration files instead of
configuring all settings using the GUI or CLI.
© FORTINET
To configure the FortiWeb system time
1. Open a Display connection to your Student-Linux VM.
2. Open Firefox, and then make a connection to https://10.0.1.7 or use the FortiWeb browser shortcut.
3. If prompted, accept and continue the HTTPS warning message.
FortiWeb uses a self-signed certificate by default.
4. Log in to the FortiWeb GUI with the username admin and password password.
5. Click System > Maintenance > System Time.
6. In the Time Zone drop-down list, select your current time zone, such as (GMT-5:00) Eastern Time.
7. Select Automatically adjust clock for daylight saving changes.
8. Click OK.
A long timeout period is not typical in a production network. During this course, a long
timeout allows you to avoid logging in repeatedly between labs. But, in a production
network, the timeout period should be five minutes or less. Failure to prevent access to
an unattended administrative session compromises the security of your network.
In this exercise, you will configure and implement local logging, which you will use in future labs.
You will enable local logging, and then verify that expected events are being recorded.
© FORTINET
2. Log out of the FortiWeb GUI.
In this lab, you will configure FortiWeb in reverse proxy mode to establish web traffic flow. You will also configure
HTTP content rewrite and HTTP redirect.
Objectives
l Access the GUI
l Verify connectivity to the web servers
l Configure FortiWeb in reverse proxy mode
l Configure FortiGate to forward web requests for FortiWeb and pass original client IP addresses
l Use content routing rules to direct traffic to specific servers
Time to Complete
Estimated: 60 minutes
In this exercise, you will configure and verify a virtual server pool. This allows you to access multiple independent
hosts using a single IP address. Grouping servers in a server pool allows for load balancing across those
resources, and provides a level of redundancy. As users connect to the virtual server address, FortiWeb redirects
the requests to one of the back-end servers that are members of the pool.
Before you begin to apply protection, you must first verify that HTTP traffic can pass through FortiWeb. To do this,
you configure, and then connect to the virtual server IP address. Then, a web page opens that is hosted on one of
the back-end protected servers, which verifies the routing, virtual servers, and policy configuration.
The web servers that you will be configuring FortiWeb to protect are already configured. You will verify
connectivity to the web servers.
Virtual server pools allow multiple, discrete servers to be pooled together under a single IP address. You will
configure a virtual IP address and a virtual server pool.
© FORTINET
Field Value
Name vserver1
Interface port1
Field Value
Virtual IP vserver1
This setting defines the IP address where FortiWeb reverse proxy will pick up HTTP requests.
During an HTTP session, FortiWeb should consistently route requests from the same client to the same back-end
web server. You will configure FortiWeb to attach a cookie to the session so FortiWeb can track all sessions
between the client and the protected server.
Field Value
Name session-persistence-cookie1
Type Source IP
© FORTINET
Add a Health Check
Health checks monitor back-end servers for availability, and forward requests to the servers only if they are
running. You will add a health check.
Field Value
Type HTTP
Matched Content .*
FortiWeb forwards traffic to the web servers for load balancing. You will define the web servers.
Field Value
Name server-pool1
Persistence session-persistence-cookie1
3. Click OK.
4. Click Create New, and then type the following IP address for the first web server:
© FORTINET
Field Value
IP address 10.0.1.21
5. Click OK.
6. Click Create New, and then type the following IP address for the second web server:
Field Value
IP address 10.0.1.22
7. Click OK.
In the lab, the servers and virtual devices are all on the same 10.0.1.0/24 subnet.
This allows you to access each web server GUI.
You will add a policy to combine and apply your previous proxy pickup and load balancing settings, and to allow
HTTP traffic flow, unless it violates your security policy.
Field Value
3. Click OK.
© FORTINET
To review the policy status
1. Continuing on the FortiWeb GUI, click System > Status > Policy Status.
You will see two entries, one for each web server that you have configured policy1 to monitor.
If FortiWeb can connect successfully to those servers by HTTP, both link icons in the Health Check Status
column are green.
You can also monitor the status of the servers in the event log.
Because you are load balancing between two identical servers, the page should look almost the same
regardless of which server receives your page request. The only difference might be the title—LINUX1 - Just
another WordPress site or LINUX2 - Just another WordPress site—which changes if the session cookie
expires, or if a new session is created for any other reason and FortiWeb directs the next request to a different
back-end server.
2. Return to the FortiWeb GUI, and then click Log&Report > Log Access > Traffic.
You will see both your request and the server reply.
If FortiWeb had blocked the request, you would see the request only—no reply. The blocked request would be
recorded in the attack log instead.
3. Return to the Student-Linux VM, and in Mozilla Firefox, click Live HTTP Headers ( ), and then refresh the page.
This may take a minute to display, and you may have to refresh the screen by clicking on any open window.
What is the value for cookiesession1? This is your persistence session ID from FortiWeb.
4. Click Forget Me Not ( ), and then click Clean this domain! to delete the cookies and close the browser.
5. Open Mozilla Firefox again, and then visit the virtual server address at http://10.0.1.8/.
Is the blog title the same? Compare the value of the session cookie with the values in previous steps.
© FORTINET
Are any of the cookie values identical? Did FortiWeb forward the traffic to the same back-end web server or a
different one?
Don't be surprised if FortiWeb consistently sends traffic to the same server. The
important setting is that a persistence cookie is being set, so that all connections from a
particular IP address are sent to the same server.
In this exercise, you will create a virtual server address on FortiGate. This virtual server address is used as an
internet-facing address which will then redirect connections to the internal FortiWeb. FortiWeb will then analyze
the network traffic before passing it on to the protected back-end web servers.
You will configure FortiGate to work as a load balancer performing destination NAT. This is a common scenario in
which FortiGate provides load balancing functions for resources other than web servers.
Because FortiWeb provides load balancing specifically for web servers, you must configure FortiWeb to
recognize, accept, and respond to requests correctly from FortiGate.
The load-balance feature is necessary so that the virtual server features appear on the FortiGate GUI. Otherwise,
virtual servers are hidden.
Field Value
Name vserver-to-FortiWeb
Type HTTP
Interface any
© FORTINET
Don’t enable the multiplex HTTP requests/responses over a single TCP
connection setting. The purpose of this setting is to improve performance with back-
end servers by eliminating repetitive TCP handshakes for small HTTP requests.
However, in this case, it can sometimes conflict with FortiWeb blocking, which can
reset the TCP connection, and can result in blocking innocent requests.
Enabling the Preserve Client IP setting is crucial. This is what transmits the original client IP address in an X-
header at the HTTP layer, so that FortiWeb can block the session based on that IP address, and not the
FortiGate egress interface IP address.
3. Scroll down to the Real Servers section, and then click Create New.
4. Configure the following settings:
Field Value
IP Address 10.0.1.8
Port 80
Mode Active
Usually, you should configure the Max Connections setting to a higher value—to a
number appropriate for your FortiWeb model's specifications. For this lab, 100 is
enough.
5. Click OK.
6. Click OK again.
7. Click Dashboard > Status.
8. Click the + symbol below FortiView Sessions to add a new monitor.
9. Under Network, select the + icon beside Load Balance.
10. Keep the default settings, and then click Add Monitor.
11. Click Dashboard > Load Balance Monitor.
You will see your mapping between the FortiGate virtual server and your real server definition, which points to
the virtual server on FortiWeb.
On FortiGate, you will add a policy that accepts all connections to the virtual server on port1, and then applies
destination NAT. Packets will egress toward the FortiWeb virtual server.
© FORTINET
To apply the load balancer
1. Continuing on the FortiGate GUI, click Policy & Objects > Firewall Policy.
2. Click Create New.
3. Change the Inspection Mode to Proxy-based, and then configure the following settings:
Field Value
Action ACCEPT
NAT enabled
4. Click OK.
In the lab, all VMs are on the same subnet. That way, you can access all VMs directly.
5. Drag and drop the Load Balancer policy above the Student-LAN policy.
You will test your configuration by accessing the FortiGate virtual server.
© FORTINET
To test the virtual server on FortiGate
1. On the Student-Linux VM, open Mozilla Firefox, and then visit the FortiGate virtual server at
http://10.0.1.253/.
Through this virtual server on FortiGate, which links through the virtual server on FortiWeb, you can see the
web pages of one of the back-end servers.
Traffic is passing from your browser to FortiGate, then on to FortiWeb, and finally to the web servers.
2. Click the bookmarked folder Attacks > Open all in Tabs. These will simulate two attacks against your web
servers.
l Attack1 uses cmd.exe to perform a command injection attack on the FortiGate virtual server:
http://10.0.1.253/../../../cmd.exe.
This attack can be achieved in the HTTP request URL and arguments. For more information, see the
FortiWeb signature ID: 050050030 Generic Attack-Command Injection.
l Attack 2 runs a SQL query to get database information from the FortiGate virtual server:
http://10.0.1.253/index?q=select%20count(*)%20from%20USERS.
This attack can be achieved in the HTTP request URL and arguments. For more information, see the
FortiWeb signature ID: 030000078 SQL injection.
Why does FortiWeb log the attack attempts with the source as 10.0.1.254—the port1 physical interface
IP address of FortiGate—and not the IP address of your Windows system?
Packets egress through port1 on FortiGate when forwarded to FortiWeb. While correct from the IP layer
perspective, the attack log currently doesn’t reveal the IP address of the original client—your web browser.
In a real network, FortiWeb would block connections from the FortiGate IP address when FortiWeb detects
an attack, which would affect innocent clients.
To fix this, you must configure both devices to use X-headers to communicate about the original client IP
address.
In this exercise, you will configure FortiWeb to support source NAT using the X-Forwaded-For method.
Now that FortiGate is configured as a load balancer using source NAT, you must configure FortiWeb to recognize
and respond to requests correctly. You do this by configuring FortiWeb to recognize and respond to specific X-
headers in very specific ways.
You will configure which HTTP X-header FortiWeb uses when blocking a traffic source in order to prevent abuse,
and trust that header only when it comes from FortiGate. You must have already enabled FortiWeb traffic logs and
attack logs.
Field Value
Name x-headers1
4. Click OK.
5. Under Trusted X-Header Sources, click Create New, and then configure the following trusted source:
Field Value
IPv4/IPv6 10.0.1.254
© FORTINET
Define a Group of Signatures
You will define a group of predefined signatures, so that you can test the effect of X-headers by simulating an
attack.
Field Value
Severity High
Field Value
Severity High
To customize signatures
1. Continuing on the FortiWeb GUI, select signature1 that you added recently, and then click Signature Details.
2. In the Dictionaries pane, expand the Generic Attacks tree.
3. Right-click RFI Injection, and then click Disable.
Field Value
Name protection1
Client Management ON
Signatures signatures1
X-Forwarded-For x-headers1
© FORTINET
3. Click OK to save your changes.
You will simulate an attack to test the x-header rules that are applied in a protection profile that the policy uses.
To simulate attacks
1. On the Student-Linux VM, open Mozilla Firefox, and then visit the FortiGate virtual server at
http://10.0.1.253/.
You can access the server.
2. Open a new browser tab, and then click the bookmarked folder Attacks > Attack1 to browse for
http://10.0.1.253/../../../cmd.exe.
The connection was blocked. Why?
3. Wait 60 seconds, and then in a new browser tab, click the bookmarked folder Attacks > Attack2 to browse for
http://10.0.1.253/index?q=select%20count(*)%20from%20USERS.
The connection was also blocked. Why?
2. Click Log&Report > Log Access > Attack, and then observe the logs for the blocked attack.
Both attacks match signatures set to Period Block. Review the ATTACK log details in the pane on the right.
Note the Source IP address in the logs. This time it is 100.64.0.10, which is the IP address of your host.
© FORTINET
Why is the IP address of the FortiGate physical interface shown in the traffic logs? Which log would you use to
troubleshoot connectivity between devices in your data center?
3. In the Attack log details, see the Connection and the Packet Header information for the following:
l Host
l X-Forwarded-For
The innocent request http://10.0.1.253/ is period blocked. Why? If you use another computer to
access http://10.0.1.253/, would it work? Why or why not?
To access the back-end servers again with the innocent request, you can release the blocked IP or wait until
the blocked period ends in 60 seconds.
In this lab, you will configure HTTP content routing to route specific URLs to the individual web servers protected
by FortiWeb to allow easy troubleshooting and maintenance.
You will change the single server pool policy to one that uses content routing. It will direct traffic sent to
http://linux1/ to the Linux 1 server and http://linux2/ to the Linux 2 server. All other URLs and
http://10.0.1.8 will continue using the load balanced server pool containing both Linux 1 and Linux 2.
Field Value
Name linux1
4. Click OK.
5. Click Create New, and then type the following IP address for one web server:
Field Value
IP address 10.0.1.21
6. Click OK.
7. Click Server Objects > Server > Server Pool.
8. Click Create New, and then configure a new server pool with the following settings:
Field Value
Name linux2
9. Click OK.
10. Click Create New, and then type the following IP address for one web server:
© FORTINET
Field Value
IP address 10.0.1.22
Field Value
Name linux1
3. Click OK.
4. On the Edit HTTP Content Routing Policy screen, click Create New, and then configure the following settings:
Field Value
Field Value
Name linux2
8. Click OK.
9. On the Edit HTTP Content Routing Policy page, click Create New, and then configure the following settings:
Field Value
© FORTINET
12. Click Create New, and then configure a new routing rule with the following settings:
Field Value
Name webservers
Field Value
Match String *
6. Under HTTP Content Routing click Add, and then configure the following settings:
Field Value
Default No
7. Click OK.
8. Click Add, and then configure the following settings:
Field Value
Default No
© FORTINET
9. Click OK.
10. Click Add, and then configure the following settings:
Field Value
Default Yes
If you do not see any entries in the traffic log, be sure to enable Enable Traffic Log
under Log&Report > Log Config > Other Log Settings.
© FORTINET
Note that, by default, FortiWeb logs the policy, HTTP content routing rule, and server pool used for each
connection to aid in troubleshooting.
5. In the upper-left corner of the header bar of the traffic logs, highlight and click the gear icon to make content routing
troubleshooting easier.
6. Select Server Pool from the available options.
These are additional columns that can be displayed.
7. Click Apply.
A new column is added, displaying the server pool used for each connection, to make verifying content
routing easier.
In this lab, you will configure FortiWeb to scan for common configurations on your target websites.
Objectives
l Enable FortiWeb vulnerability scans
l Configure a very basic vulnerability scan to identify a common vulnerability on the target web server
l Use HTTP header rewrites to remove sensitive information from a connection
Time to Complete
Estimated: 30 minutes
The web vulnerability scanner allows you to use prepackaged scans or custom scans to discover vulnerabilities
on protected websites.
By default, the web vulnerability scanner is a hidden feature. You will enable it and perform a basic scan against a
target website.
Field Value
Name fast-scan1
Field Value
Name fast-scan
Profile fast-scan1
© FORTINET
Be careful when you run a scan against a production web server—it can cause
slowdowns and disconnects. Use a copy of the server or run the scan during
scheduled downtime.
You will create a new scan to target some specific vulnerabilities an administrator wants to check for.
Field Value
Name id-scan1
© FORTINET
Note this scan is configured to use the virtual IP (10.0.1.8) and not directly connect
to the web server. This can have drastic effects on your vulnerability scan because
results from directly scanning a web server are different than scanning from FortiWeb.
Field Value
Name id-scan
Profile id-scan1
3. Click OK to save.
The scan starts immediately. Wait for the scan to finish.
In this lab, you will modify content in an ongoing HTTP session. In the previous lab, you identified two HTTP
headers that were revealing unnecessary information about the web servers. In this lab, you will configure
FortiWeb to strip those headers in the HTTP response. No configuration changes on the web servers are required.
You can apply HTTP rewrite rules to both HTTP requests and responses. In this case, you will configure FortiWeb
to strip the server and x-powered-by headers in an HTTP response.
Field Value
4. Click OK.
5. In the URL Rewriting Condition table, click Create New, and then configure the following settings:
Field Value
Protocol HTTP
6. Click OK.
7. Under HTTP Header Removal, click the add icon (+) beside Header Field Name to create a new entry.
8. In the first field, type server.
9. Click the add icon (+) beside Header Field Name again to create another new entry.
10. In the second field, type x-powered-by.
11. Click OK.
© FORTINET
To create a new rewrite policy
1. Continuing on the FortiWeb GUI, click Application Delivery > URL Rewriting > URL Rewriting Policy.
2. Click Create New, and then configure the following setting:
Field Value
Name HTTP-header-remove
3. Click OK.
4. Click Create New, and then configure the following setting:
Field Value
5. Click OK.
You can add multiple rules to the same URL rewriting policy. For example, you can
combine the HTTP-HTTPS redirection and header removing rules in one policy.
However, for troubleshooting and flexibility, it is recommended that you keep them
separate.
Field Value
4. Click OK.
You will test your configuration using the web vulnerability scan you configured in the previous exercise, and then
review the results.
© FORTINET
To review the results
1. Continuing on the FortiWeb GUI, click Web Vulnerability Scan > Scan History.
2. Click an entry to view the results.
3. Review the results.
Notice that the two vulnerabilities no longer appear in the report. One has been replaced with an omitted
server header informational warning, and the other is no longer reported.
While stripping the header is an acceptable stop-gap measure of hiding the server's
vulnerability, it is still highly recommended that you apply security patches to back-end
servers to ensure maximum protection.
In this lab, you will configure machine learning anomaly detection features on FortiWeb. These features allow you
to quickly and easily provide a high level of protection for your web applications.
You will also use a number of penetration testing tools to test, observe, and review machine learning anomaly
detection in action.
Objectives
l Configure web protection rules
l Test access control
l Configure user tracking rules and policies
l Test user tracking
l Define host names and users
l Enable HTTP authentication
l Test HTTP authentication
l Define a custom initiation page
l Test session initiation rules
Time to Complete
Estimated: 55 minutes
© FORTINET
In this exercise, you will enable advanced web protection rules to limit sessions and requests. By limiting these,
you reduce the risk and impact of DoS attacks.
Field Value
Name combo-access-control-rule1
Severity High
4. Leave all other settings at the default values, and then click OK.
5. Click Add Filter.
6. In the Filter Type list, select Access Rate Limit.
7. Click OK.
8. In the HTTP Request Limit/sec field, type 2.
9. Click OK.
10. Click OK to save the new match condition.
11. Click Add Filter again.
12. In the Filter Type list, select Source IP.
13. Click OK.
14. In the Source IPv4/IPv6/IP Range field, type 100.64.0.10.
15. Click OK.
16. Click OK again.
In the filter types, you can create very complex requirements in order to restrict access
to very specific clients and conditions.
If your web application, such as Microsoft OWA or SharePoint, already provides its
own authentication, access controls can help to protect them from a brute force attack
and from unauthorized IP addresses.
© FORTINET
To create custom policies
1. Continuing on the FortiWeb GUI, click Web Protection > Advanced Protection > Custom Policy.
2. Click Create New.
3. In the Name field, type combo-access-policy1.
4. Click OK.
5. In the rule section, click Create New.
6. In the Custom Rule drop-down list, select combo-access-control-rule1.
7. Click OK.
8. Click OK again.
Field Value
Name cookie-poisoning1
Severity High
4. Click OK.
You will apply the web protection rules to a web protection profile, and then apply the web protection profile to a
policy.
Field Value
4. Click OK.
© FORTINET
With the x-headers1 profile applied, the rate limit would be applied to the client IP
address, and not to the FortiGate IP address.
1. On the Student-Linux VM, open a browser, and then click the clear cache icon ( ).
2. Open a new browser tab, and then connect to http://10.0.1.8/.
This time, because FortiWeb is limiting each client to two requests a second, and the web page has more
than two components—images, scripts, and so on, are all separate from the web page and are separate
requests themselves—FortiWeb blocked those requests. In a real network, you should set the rate limit to a
small multiple of the number of requests required for each page. This is usually much higher, such as 50, but
the number depends on the web page.
1. Continuing in the browser, click the preferences menu icon ( ) located in the upper-right corner of the window.
2. Click Web Developer > Network.
A tools panel appears below the web page.
3. On the tools panel, click Reload.
© FORTINET
Stop and think!
How many requests are required for the browser to download all parts of the page? Look in the lower-right
corner of the window.
Because the web page uses various CSS style sheets, it issues multiple requests to access all of the
required resources.
When the custom rule limited the number of requests to two, the page can’t load correctly because
additional requests are being blocked by FortiWeb. As you can see in the developer tool in the browser, the
page requires more than 10 requests in order to load correctly. To fix this, you must allow a sufficient
number of requests for normal page operation in your custom rule.
In this exercise, you will enable user tracking on FortiWeb. This allows you to track sessions by user, and capture
a username to reference in traffic and attack log messages. Availability of this information gives you more granular
control over access to web resources, as well as improves post-attack forensic analysis.
Field Value
Name tracking-rule1
Session Timeout on
Timeout 1
Severity High
Notice that the Action and Severity fields are available only after you enable the Session Timeout
Enforcement setting. These options define how FortiWeb handles user sessions that have timed out.
4. Click OK.
© FORTINET
To define an authentication condition
1. Continuing on the User Tracking Rule configuration page, in the Authentication Result Condition Table
section, click Create New.
2. Configure the following settings:
Field Value
Value /index.php
3. Click OK.
4. Click OK again.
You will create a user tracking policy, and then apply it to a web protection profile.
© FORTINET
To test user tracking
1. On the Student-Linux VM, open a browser, and then connect to the bookmarked site named vserver’s DVWA at
http://10.0.1.8/dvwa/login.php.
2. Log in with the username admin and password password.
3. Visit the Command Injection page, and then enter the following command:
10.0.1.8;cd ../../;ls
The attempt is blocked.
4. Do not interact with the site for one minute to allow the timeout period to pass.
5. Close the Student-Linux VM browser tab.
In this exercise, you will apply authentication requirements to protect specific, defined websites using their host
names.
Field Value
Name hostnames1
5. Click OK.
6. Click Create New, and then configure the following host name settings:
Field Value
Host www.example.com
Action Accept
7. Click OK.
8. Click Create New again, and then configure the following host name settings:
Field Value
Host 10.0.1.8
Action Accept
9. Click OK.
10. Your configuration should match the following example:
© FORTINET
If this server hosts websites for many domains, including subdomains such as
store.example.com, you should add all domain names here.
Field Value
Name user1
Password test
3. Click OK.
For a larger user list, you should define an LDAP or RADIUS query to a remote
authentication server.
© FORTINET
Field Value
Name user1
You will group the new rule into an HTTP authentication policy, which can include many websites with common
connection timeouts, session caches, and other identical settings. During the testing phase of this lab, you want to
view all authentication attempts—not just failures—so you will also log successful attempts.
You will define which user accounts are authorized to access a specific URL, and which authorization realm the
URL belongs to.
Field Value
Name HTTP-auth-realm1
Host www.example.com
4. Click OK.
5. Click Create New.
6. Configure the following settings:
Field Value
Auth Path /
7. Click OK.
8. Click OK again.
© FORTINET
To configure the HTTP authentication policy
1. Continuing on the FortiWeb GUI, click Application Delivery > Authentication > Authentication Policy.
2. Click Create New.
3. Configure the following settings:
Field Value
Name HTTP-auth-settings1
Cache Timeout 15
4. Click OK.
5. Click Create New.
6. In the Auth Rule drop-down list, select HTTP-auth-realm1.
7. Click OK.
8. Click OK again.
The cache timeout you configured is unrealistically small. This is so you don't have to
wait long for the authentication session to expire, and so you can try it again with a
slightly different URL or user account.
However, in a real production network, you should configure the cache timeout to be
300 seconds or higher. This allows users to read the web page, and click the next link
without FortiWeb prompting them to reauthenticate.
Remember, between each test you must wait 15 seconds, and then restart your browser. This is because of the
cache timeout setting and, by default, the browser keeps authentication cookies until you restart the browser.
© FORTINET
To test the authentication and authorization settings
1. On the Student-Linux VM, open a browser, click the Clear Cache icon ( ), and then browse to
http://www.example.com/.
2. Click Cancel.
3. In a new browser tab, connect to the FortiWeb virtual server IP address at http://10.0.1.8/.
An authentication prompt does not appear. Why?
In this lab, you will configure FortiWeb to test and block two very common web-based attacks.
Objectives
l Execute, detect, and block a basic XSS attack
l Execute, detect, and block a basic SQL injection attack
l Create a custom signature used to block an attack
Time to Complete
Estimated: 35 minutes
In this exercise, you will configure FortiWeb to block two common attacks, and then observe how the default
security policy detects and blocks the attempts.
You will attempt to push a simple string of code used in an XSS attack to a vulnerable web server.
This is a simple string of code that can trigger an XSS attack, and should not be
allowed to be submitted to a web server.
5. Click Submit.
What is the specific piece of code that triggered the signature detection?
You will attempt to submit a simple SQL injection attack to a vulnerable web server, and then see how FortiWeb
responds.
© FORTINET
3. Click Sql Injection.
4. In the input field, type SELECT * FROM users where id = '1';.
This is a sample of a blind SQL injection command, which should always be blocked
when submitted to a web server.
5. Click Submit.
6. Close the Student-Linux VM browser tab.
In this exercise, you will configure FortiWeb to block an attack with a custom string.
You will configure a custom signature that FortiWeb will use to block a connection before the traffic can be passed
on to the protected server.
Field Value
Name custom-signature1
Severity High
5. Click OK.
6. Click Create New.
7. Configure the following settings:
Field Value
8. Click OK.
9. Click OK again.
© FORTINET
3. In the Name field, type signature-group1.
4. Click OK.
5. Click Create New.
6. In the Custom Signature drop-down list, select custom-signature1.
7. Click OK.
8. Click OK again.
You can add multiple signatures to the same signature group. You can select only one
custom signature group in a policy.
You will test the custom signature configuration by attempting a new attack on the web servers.
The signature matches in the URL and the connection is blocked like a preconfigured
signature.
© FORTINET
You will see the custom signature detection attack error.
In this lab, you will test your lab web servers for vulnerabilities to specific denial-of-service (DoS) attacks. After you
identify the vulnerabilities, you will implement some FortiWeb configurations to help protect against those attacks.
Objectives
l Test a website for vulnerability to a non-volumetric type of DoS attack
l Configure FortiWeb to detect a non-volumetric DoS attack
l Configure web anti-defacement to revert the changing of a website
Time to Complete
Estimated: 50 minutes
In this exercise, you will configure FortiWeb to protect your network against a slow headers DoS attack.
You will enable the web protection profile that you previously disabled. Since FortiWeb applies the specified
default and custom protection profiles before applying the machine learning anomaly detection, both can be
enabled from this point on.
You will test your environment in order to identify any DoS weaknesses, and then configure FortiWeb to address
those weaknesses. You will use a preconfigured script that will execute the SlowHTTPTest tool, with all
appropriate arguments. The script is configured to run the test for 90 seconds, and to initiate 1005 connections.
© FORTINET
These results indicate that the DoS attack is successful because only a portion of the 1005 connection
attempts were able to connect.
3. Open File Manager from the bottom bar, and then navigate to home > fortinet > results.
4. Double-click the file named slowhttp_1.html to view it.
The test results are displayed.
© FORTINET
To test the FortiWeb virtual server vulnerability
1. Return to the terminal window, and then enter ./slowhttptest.sh test2.
This test targets the FortiWeb virtual server (http://10.0.1.8/).
Does the attack succeed? Notice that FortiWeb is not rejecting or period blocking the attack source IP
address.
© FORTINET
Ideally, to save resources, you should configure FortiWeb to efficiently block this kind
of malicious behavior. The same client IP address is opening an abnormally high
number of TCP connections, even though the rate of HTTP requests per second is not
necessarily suspicious.
Distinguish Clients
You will configure FortiWeb to distinguish clients behind the same public IP address. This is especially useful in
situations where clients are connecting from shared offices or public spaces.
You will define a sensor that detects an excessive number of TCP connections per IP address, which you tried
earlier using the slowhttptest.
Field Value
Name excessive-connections1
Block Period 60
Severity Medium
© FORTINET
Field Value
Name dos-sensors1
3. Click OK.
You will use the slowhttptest script to generate attack traffic and test your configuration.
Observe that FortiWeb accepts connections at first, but once the test exceeds 10 concurrent TCP
connections, FortiWeb blocks all connections after that for the next 60 seconds. At this point, if you attempt to
connect from your browser to http://10.0.1.8, the connection is immediately rejected.
© FORTINET
2. When the test completes, return to File Manager, and then navigate to the home/fortinet/results folder.
3. Double-click the file named slowhttp_3.html to view it.
The test results are displayed.
© FORTINET
To review the logs
1. Return to the FortiWeb GUI, click Log&Report > Log Access > Attack, and then observe the logs for the blocked
DoS attack.
In this exercise, you will configure FortiWeb to detect and recover from a website defacement.
You will configure FortiWeb to copy files from your web server to detect and reverse defacement attacks.
Field Value
Name linux1
Hostname/IP 10.0.1.21
Password bitnami
3. Click OK.
4. Wait a couple of minutes for FortiWeb to back up and hash the website.
5. Click Create New to create a similar entry for the Linux2 web server.
© FORTINET
Field Value
Name linux2
Hostname/IP 10.0.1.22
Password bitnami
Deface a Website
To test defacement, you will log in and manually edit the WordPress site that is the homepage for Linux1. Then,
you will monitor how FortiWeb responds to the change in the web server.
In this lab, you will implement the FortiWeb machine learning anomaly detection feature. This feature allows you
to quickly and easily provide a high-level of protection for your web applications.
You will also use a number of penetration testing tools to test, observe, and review machine learning anomaly
detection in action.
Objectives
l Configure anomaly detection to observe the traffic of your web applications and anticipate security needs
l Use specific penetration testing tools to teach the anomaly detection what a normal traffic pattern is
l Observe the machine learning process
l Test your protection
Time to Complete
Estimated: 40 minutes
© FORTINET
In this exercise, you will configure the FortiWeb machine learning anomaly detection capability in order to more
effectively protect your web applications.
Although the currently configured policy has some protection enabled, the currently selected protection1 profile
is configured in such a way that FortiWeb has been blocking what it perceives as attacks.
You will disable the existing protection, and then enable machine learning anomaly detection.
6. Click OK.
7. Select policy1 again, and then click Edit.
8. Scroll down to the Machine Learning section, and then click Create.
9. In the Domain field, type www.example.com, and then click OK.
You should see the following icons in the Machine Learning section. The turning gears indicate that machine
learning is now turned on.
© FORTINET
To view the machine learning policy
1. Continuing on the FortiWeb GUI, click Machine Learning > Anomaly Detection.
2. Select policy1, and then click Edit.
3. Scroll down to Allow sample collection for domains, and then in the View Domain Data column, click the View
Domain icon ( ).
Note the three tabs: Overview, Tree View, and Parameter View.
By default, when machine learning is in its collecting phase, FortiWeb accepts only 30 requests from the same IP
address. For your testing, you will configure the policy to accept unlimited samples from the same IP address (the
Student VM).
4. Enter exit.
5. Close the FortiWeb SSH session browser tab.
6. Leave the FortiWeb GUI browser tab open—you will return to it in the next exercise.
In this exercise, you will send HTTP requests to the web application in order to see how the FortiWeb machine
learning functionality works. You will first teach FortiWeb about normal traffic patterns, and then you will send
abnormal traffic to see how the anomaly detection protects your servers.
Train FortiWeb
Although FortiWeb is currently configured to perform machine learning-based anomaly detection, the device has
not yet learned anything about the normal traffic patterns for the network. You will use a script to generate 2000
unique HTTP GET requests to the URL http://www.example.com/product-lookup/?product_id=X,
where X is replaced with digits representing product IDs. These requests are looped five times. This allows
enough time to see the machine learning go from the collecting stage to the building stage, where it builds the
mathematical model, and then on to the testing stage followed by the running stage. You should also see the
ongoing sampling of data after it enters the running stage.
3. Immediately return to the FortiWeb GUI, and then click the Parameter View tab.
© FORTINET
You should now see the product_id parameter. This is discovered from monitoring the HTTP requests
destined for the web application. Note that the HMM learning stage is in the collecting stage.
Now that FortiWeb has begun learning from the generated traffic, you will use the machine learning anomaly
detection tools to review the status.
You can see the parameter <product_id> change from None to Collecting, Collecting to Building, and
Building to Running.
© FORTINET
4. Continuing under Parameter View, examine the Distribution of Anomalies triggered by HMM table. You can
see which samples were considered anomalies when the HMM model was being built, as well as the sample
length. In this case, there were no anomalies. All the samples matched the HMM model. All of the requests that you
sent to the web application from the Student VM consist of values in the Product ID field that are five digits long.
If the Product ID field took IDs from five to nine digits in length (only digits), how would these views
(boxplots and distribution of anomalies) be affected?
The boxplot would be the same, but the Distribution of Anomalies chart would be different. The boxplot
would be the same because each value of the product ID is still a numeric value (a string of five to nine
characters, each one a digit), but the sample length would be different.
Generate an Anomaly
You now know that the machine learning model for the product_id is expecting only digit values in the HTTP
requests. Now, you will test and observe what happens if you send a non-digit value.
© FORTINET
To test the current configuration
1. On the Student VM, open a new Firefox tab, and in the bookmark toolbar, click the Product Lookup bookmark.
2. In the Product ID field, type AAAAA.
3. Click Submit Query.
The website accepts the input, and then returns to the Product Lookup page.
This is because the input is not a threat—it is an anomaly. The HMM layer passes the input to the threat
model, which then validates whether the input is a threat or not. FortiWeb uses this second layer of machine
learning to verify whether it is a real attack or just a benign anomaly that should be ignored. In this case,
AAAAA was not considered a threat and was ignored. If you look at the logs in Log&Report > Log Access >
Attack, you will not see any log entries because this was not considered an attack.
In this exercise, you will use some scripts to generate attacks against your protected web servers. This will allow
you to observe the machine learning capabilities of FortiWeb. By reviewing log entries and threat models, you will
be able to see how FortiWeb protected your web applications.
You will also see how the FortiWeb machine learning model can relearn, and automatically adjust to, changes to
your web applications.
You will initiate a script-based attack against your protected web application. You will then use the available tools
to observe how FortWeb handled the attacks.
To generate an attack
You will run some attacks against the product_id parameter.
1. On the Student VM, from the bottom panel of the screen, open a terminal window.
2. Run the following command to send some malicious requests to the product_id parameter of the web
application:
./wfuzzscript.sh attacks 1
Note the 500 response code in most of the script output. This indicates that the attack was not allowed
through to the destination.
© FORTINET
Review the Logs
Now that an attack script has been run, you will use the logs and machine learning tools to view the actions
FortiWeb has taken to prevent the attacks from succeeding.
Note that the attacks you just sent are stopped by the machine learning functionality. The Message column
indicates which threat model identified the attack.
3. Click the first entry to see more information about the cross-site scripting attack.
Under the Machine Learning heading, you can see that the input from the attack, in orange, is compared to
both the HMM probability and Argument Length observed for the product_id parameter, in green. For
© FORTINET
the product_id, you know that HMM Probability is zero and Argument length is five. In other words,
FortiWeb is expecting only five digits for the product_id value—that is not what is observed for this request,
and therefore an anomaly is triggered.
Under Attack Detection Information, you can see that the attack corresponds to the cross-site scripting
threat model. So, this anomaly is not benign—it is a threat.
4. In the Message column, look for Machine Learning Definite Anomaly:SQL Injection to view an SQL injection
threat.
The threat model describes this as an SQL injection attack based on the characteristics of the malicious input.
Looking at the threat analysis result for the cross-site scripting (XSS) event, why does it show Suspicious
Local (Remote) File Inclusion on the chart?
The injection shows signs of both XSS and local (remote) file injection.
The injection, which is an anomaly, has characteristics that match both threat models. The threat model that
rates the injection as most spurious is used in the reporting of the event.
You have seen how FortiWeb builds mathematical models for parameters and uses these models to detect
anomalies. You have also seen how it uses the second layer of machine learning to determine if the anomaly is
benign or a threat. Now, you will take a look at how it automatically adapts to web application changes by
detecting changes to the models it has built, and then automatically rebuilds them.
Previously, the product_id parameter took five-digit values, however, there has been a change to the web
application because new product lines have been introduced and a new format is being used for the product ID.
The product ID now takes letters and digits in the form LL(L)(L)-DDDDDD (two to four letters followed by a dash,
and then followed by six digits).
© FORTINET
To send data in the new format
1. Return to the Student VM, and then in the terminal window, run the command ./wfuzzscript.sh test2 5.
2. Return to the FortiWeb GUI, and then click Machine Learning > Anomaly Detection.
3. Select policy1, and then click Edit.
4. Scroll down to Allow sample collection for Domains, and then in the View Domain Data column, click the list
icon ( ).
5. Click the Parameter View tab, and then click product_id to see the boxplots.
6. Click the Refresh button to see the new boxplots generate from the HTTP requests.
This may take a minute or two.
8. Wait two or three minutes, and then click the Refresh button again.
FortiWeb begins the building phase. Finally, after a few minutes, FortiWeb starts the running phase.
FortiWeb has now automatically rebuilt the model for the product_id parameter based on the new values in
the HTTP requests.
© FORTINET
Stop and think!
What will the Distribution of Anomalies look like for a parameter that doesn't have such a set format?
For more randomized parameters, there would be a much larger spread both in sample length (if there was
a wide range of product ID lengths) and height (if they contained more cases of letters or numbers). In this
example, because there are very limited product_id variations, all cases fit within the two distributions.
You will look at what the distribution of anomalies will look like for a password parameter. For a password
parameter, you cannot ask users to follow such a format, and you should not, from a security point of view.
You will now send user login requests to the www.example.com website. In the case of www.example.com, the
username follows the format first initial + last name + 4 digit code, and the password must be a
minimum of six characters and contain only letters and digits.
If the wfuzzscript is still running from the previous exercise, press Ctrl+C in the
terminal window to stop it.
2. Return to the FortiWeb GUI, and then click the Parameter View tab.
3. Click the product_id to see the boxplots.
4. Click the Refresh button to update the Parameter View.
Observe that FortiWeb automatically discovers the two new parameters and enters the collecting phase.
5. Click the Refresh button until both the username and password parameters are in the Running stage.
You should notice that it is quicker to build the mathematical model for the username parameter than it is for
the password parameter. Why is this?
The username value is a set format. If the system observes an obvious pattern of HTTP request behavior for
this parameter, or there are enough valid samples to build a machine learning model, the system stops
collection and starts building the model.
The password is more random in nature and definable by the user, whereas the username has a set format.
The username has a more obvious pattern, and therefore the model is quicker to build.
6. After you see the Running stage, return to the Student VM terminal window, and then press Ctrl+C to end the
script.
© FORTINET
7. Close the Student VM browser tab.
4. In the Distribution of Anomalies triggered by HMM table, view the one definite anomaly.
5. Scroll down to the bottom of the current page, and then on the first tab, see Anomaly Samples to see the value of
the anomaly.
This is an anomaly based on all the other samples that FortiWeb observed during the collecting stage and will
not be used to build the model for the parameter. This is reported differently from an anomaly that is observed
during the running stage.
It is important to filter out the anomalies during the collection phase to make sure any rogue input does not
impact the mathematical model for the parameter.
In this lab, you will configure FortiWeb to take on the SSL security functions offered by your website. You will
upload the certificates and keys to FortiWeb, and then offload the SSL (HTTPS) functions to FortiWeb. This
ensures that all connections to your website are secured by FortiWeb already. In this way, you can use SSH from
the client to FortiWeb to the website.
Objectives
l Upload a signed certificate and private key to FortiWeb
l Configure clients to trust the website certificate
l Configure FortiWeb to provide HTTPS service, instead of your back-end servers
l Disable weak cryptography
Time to Complete
Estimated: 40 minutes
In this exercise, you will upload a certificate and key to FortiWeb to use for HTTPS and SSL connections to your
website. Then, you will upload the server certificate and private key to FortiWeb, which will offer HTTPS
(performing the certificate and cryptographic operations) to clients for all back-end web servers.
You will download the server certificate, and then upload it to FortiWeb.
What is the difference between the file contents? Which file contains the private key?
The server.crt file is a basic server file. It contains the Distinguished Name (DN) information and the
public key file. Notice the certificate is signed, but it is signed by itself. This is a self-signed certificate.
The server.key file is only an RSA private key. This is the corresponding private key to the server.crt
certificate.
© FORTINET
Field Value
Type Certificate
Certificate file Browse to /home/fortinet/, and then select the server.crt file.
Key file Browse to /home/fortinet/, and then select the server.key file.
4. Click OK.
3. Click Close.
You will look for the private key in the FortiWeb backup files.
Field Value
Backup selected
Encryption disabled
3. Click Backup.
4. Download the backup file again, but this time, encrypted with the password fortinet.
5. Extract both configurations from the downloaded ZIP files.
6. Open both configuration files in a plaintext editor, such as Text Editor.
Is the certificate private key in the backup file?
© FORTINET
Field Value
Name FortiWebFTP
3. Click OK.
4. Click Log&Report > Log Access > Event, and then refresh the logs page until you see the following log:
5. Create a backup file again, but this time, encrypted with the password fortinet.
6. Log out of the FortiWeb GUI.
How much larger is the current backup file than the backup from the UI in the previous lab?
The difference between a CLI backup and a full configuration backup is significant. In these labs, full backup
files can be 5–10 MB, while CLI backup files are much smaller at about 75 KB.
Is there any part of the full configuration backup that is now binary instead of CLI commands in ASCII text?
A full configuration backup backs up additional information, such as modified signature files, block pages,
and other customizations that are not fully expressed by CLI commands. That information is stored in the
binary text of the configuration file.
Which backup files, if any, must be password-encrypted and stored securely to properly safeguard your
private keys?
It is always a good practice to encrypt the backup files of any security device. In the case of FortiWeb,
because it backs up the server public and private keys in the configuration backup, always remember to
encrypt and properly secure the file.
© FORTINET
3. Close FileZilla.
4. Close the Student VM browser tab.
In this exercise, you will configure FortiWeb to manage all of the HTTPS communications with your website rather
than depending on the web server itself.
Field Value
Certificate server
4. Click Advanced SSL settings > SSL Connection Settings, and then configure the following settings:
Field Value
5. Click OK.
6. In the Web Protection Profile drop-down list, select protection1, if it is not already selected from the previous
labs.
7. Click OK.
© FORTINET
Stop and think!
Each web page usually consists of multiple HTTP or HTTPS requests—one for the HTML page itself, and
then others for images, movies, external CSS or JavaScript, and other components. If you right-click and
select the browser View Page Source feature, you can search for http:// to find components whose
requests are not SSL/TLS-secured, and therefore aren't displayed over an HTTPS connection.
4. On the browser URL bar, click the lock icon ( ), and then click Connection > Disable protection for now.
The website displays correctly.
Can you find which version of SSL/TLS your browser is using to view the web pages?
Both your browser and the FortiWeb logs may have this information.
To send an attack
1. Continuing on the Student VM, open another browser tab, and then connect again to https://10.0.1.8/.
2. On the browser URL bar, click the lock icon ( ) to enable protection.
3. In the search field, type the following SQL injection attack:
SELECT * FROM mysql.user;
4. Click Search.
5. Return to the FortiWeb GUI, click Log&Report > Log Access > Attack, and then examine the attack log for the
SQL injection.
Does FortiWeb successfully scan the HTTPS request, and then block the SQL injection, even though the
page is encrypted? How can you verify this?
Although the page is encrypted, this particular attack information is sent over an unencrypted connection,
and therefore FortiWeb successfully blocks the attack.
6. Return to the Student VM, open another browser tab, and then connect to https://10.0.1.8/dvwa.
7. Log in with the username admin and password password.
8. Click SQL Injection.
9. In the User ID field, type the following SQL injection attack:
SELECT * FROM mysql.user;
© FORTINET
10. Click Submit.
11. Close the Student VM browser tab.
12. Return to the FortiWeb GUI, and then click Log&Report > Log Access > Attack.
13. Examine the attack log for the SQL injection.
Unlike the previous attack, this attack was conducted over an HTTPS connection. The submitted
attack was intercepted and blocked even before the traffic was decrypted because FortiWeb
detected the signature in the HTTPS URL.
In this lab, you will configure a basic bot mitigation policy to detect if a bot attempts to crawl and download the
contents of a protected website. You will then execute the bot to download the website, and then verify the logs of
the attempt.
Objectives
l Configure a FortiWeb bot mitigation policy
l Block an attempt to crawl and download a protected website
Time to Complete
Estimated: 30 minutes
In this exercise, you will configure a bot mitigation policy to prevent a web scraper from downloading the contents
of a protected website. You will then use the HTTrack program to attempt to scrape the contents of a protected
website, and then observe the results.
You will configure a basic bot mitigation policy to block web scraping.
Field Value
Name threshold-rule1
Field Value
Name bot-policy1
© FORTINET
Field Value
3. Click OK.
You will use the httrack command to generate a web scraping attack and test your configuration.
Notice that FortiWeb accepts connections at first, but eventually the crawler is unable to download any
information. FortiWeb identifies the program as a scraping bot and starts blocking connections.
© FORTINET
Because the threshold is 10, the crawler could not download the entire website. You can adjust threshold
levels to maximize performance, but be careful of triggering false positives and blocking legitimate web
usage.
In this lab, you will perform some basic tasks related to troubleshooting issues. Along with generating some
baseline data to help you determine if and when there is an issue, you will also look at some of the tools available
to help reduce false positive situations.
A false positive situation occurs when FortiWeb incorrectly takes protective action when none should be taken. In
other words, by doing its job, FortiWeb is in fact hindering the normal operation of your site. You will use some of
the tools available to help FortiWeb understand what is harmful and what is normal in order to ensure your website
displays correctly to end users.
Objectives
l Determine normal network and hard disk usage
l Locate a signature that is causing false positives, which is blocking normal traffic
Time to Complete
Estimated: 30 minutes
To effectively determine if there are issues in the network, it is important to know what the network looks like
during normal operations.
You will use a variety of tools to determine a baseline for your network and hard drives.
When the attack finishes, what is the highest number of concurrent connections that FortiWeb handled?
What strategies could you use to reduce unnecessary RAM and CPU usage?
One of the largest burdens on web server RAM are active connections. If there are ways to reduce the
number of connections actually hitting your web server (filter IP addresses by geolocation, use connection
limiting, reduce the number of required connections and element uploads), this reduces the burden on the
web server.
CPU usage can most efficiently be saved by offloading any SSL or encryption burdens. Encrypting and
decrypting SSL connections is very processor intensive.
© FORTINET
2. Enter the following CLI commands:
diagnose hardware harddisk list
diagnose system mount list
diagnose system flash list
How many disks are listed?
In a virtualized FortiWeb, there is only one hard disk that stores all static configuration information and
logging. FortiWeb also stores a backup of the previous firmware that has been used, for the easy rollback of
patches. This can be done on the CLI or on the GUI under System > Maintenance > Firmware.
It is important to ensure that you have correctly configured FortiWeb to prevent false positive detections. This
prevents FortiWeb from incorrectly blocking normal website interactions. In this exercise, you will look for, find,
and fix a number of false positive conditions.
You will identify and resolve a number of false positives. If you have not restored the fwb_
troubleshooting.zip configuration file to the FortiWeb, do so before continuing this exercise.
It appears a custom signature matching the string "wombats" has triggered the event.
3. Log in to the FortiWeb GUI with the username admin and password password.
4. Click Log&Report > Log Access > Attack.
5. Click Web Protection > Known Attacks, locate the offending custom signature in the previous step, and then
change the Action to Alert.
6. Return to the Student VM, and then try your search again.
Because FortiWeb is now using the Alert action when the signature is detected, the page loads correctly.
Alert still means the incident is logged according to the policy. You will continue to see records of the
offending signature until it is removed. This can be a low-impact way to keep track of certain types of web
activity, and to highlight suspicious, but not actively harmful, behaviors.
© FORTINET
The page loads, but the password reset fails. This is expected.
5. Continuing on the Student VM, open a new browser tab, and then try to reload the web server at
http://10.0.1.8/.
The website is currently not responding. Why? Check the FortiWeb attack logs.
6. Return to the FortiWeb GUI, and then click Log&Report > Log Access > Attack.
7. Use the logs to identify what is causing the page to be denied.
8. In FortiWeb, navigate to Web Protection > Known Attacks > Signatures > signatures1.
9. Click Signature Details.
10. Expand Information Disclosure, and then click Application Availability/Errors.
11. Find the configuration error so that clients are not blocked when they attempt to visit the reset password page.
Yes, because an administrator didn't configure the threat weight of the Application Availability/Errors
signature correctly. The web page is flagged as a critical threat weight, and therefore the client is
immediately denied.
12. In the signature 08008001, lower the threat weight to Low, which is the normal default for this signature.
13. Navigate to Policy > Client Management > Configuration.
14. Verify that a score of 200 (the default for a low threat weight) will not flag a client as malicious and block
connections. If this is not the case, adjust the slider accordingly so a threat score of 200 falls under the suspicious
range.
15. Click Apply.
16. Return to the Student VM, and then in the browser tab connected to http://10.0.1.8, scroll to the bottom of
the page, and then click Log in.
17. Click Lost your password.
18. Type the name user.
19. Click Get New Password.
20. Open a new browser tab, and then connect to http://10.0.1.8.
The connection should be allowed.
21. Verify the logs by clicking Log&Report > Log Access > Attack.
Note that there is still an alert, but since it is only Low, it gives the client a score of 200, which is not enough to
deny the connection.
No part of this publication may be reproduced in any form or by any means or used to make any
derivative such as translation, transformation, or adaptation without permission from Fortinet Inc.,
as stipulated by the United States Copyright Act of 1976.
Copyright© 2022 Fortinet, Inc. All rights reserved. Fortinet®, FortiGate®, FortiCare® and FortiGuard®, and certain other marks are registered trademarks of Fortinet,
Inc., in the U.S. and other jurisdictions, and other Fortinet names herein may also be registered and/or common law trademarks of Fortinet. All other product or company
names may be trademarks of their respective owners. Performance and other metrics contained herein were attained in internal lab tests under ideal conditions, and
actual performance and other results 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 certain expressly-identified
performance metrics and, in such event, only the specific performance metrics expressly identified in such binding written contract shall be binding on Fortinet. For
absolute clarity, any such warranty will be limited to performance in the same ideal conditions as in Fortinet’s internal lab tests. In no event does Fortinet make any
commitment related to future deliverables, features, or development, and circumstances may change such that any forward-looking statements herein are not accurate.
Fortinet disclaims in full any covenants, representations,and guarantees pursuant hereto, whether express or implied. 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.