{"id":12731,"date":"2023-11-13T06:00:36","date_gmt":"2023-11-13T11:00:36","guid":{"rendered":"https:\/\/blog.litespeedtech.com\/?p=12731"},"modified":"2023-11-13T06:00:36","modified_gmt":"2023-11-13T11:00:36","slug":"owasp-with-openlitespeed-faq","status":"publish","type":"post","link":"https:\/\/lswp.store\/index.php\/2023\/11\/13\/owasp-with-openlitespeed-faq\/","title":{"rendered":"Common Questions About OWASP with OpenLiteSpeed"},"content":{"rendered":"<p><img fetchpriority=\"high\" decoding=\"async\" class=\"alignnone size-full wp-image-12733\" src=\"https:\/\/lswp.store\/wp-content\/uploads\/2023\/11\/ols-owasp.png\" alt=\"OWASP with OpenLiteSpeed\" width=\"1000\" height=\"500\" srcset=\"https:\/\/lswp.store\/wp-content\/uploads\/2023\/11\/ols-owasp.png 1000w, https:\/\/lswp.store\/wp-content\/uploads\/2023\/11\/ols-owasp-300x150.png 300w, https:\/\/lswp.store\/wp-content\/uploads\/2023\/11\/ols-owasp-768x384.png 768w, https:\/\/lswp.store\/wp-content\/uploads\/2023\/11\/ols-owasp-600x300.png 600w\" sizes=\"(max-width: 1000px) 100vw, 1000px\" \/><\/p>\n<p>Running into difficulty with mod_security? Our support team provided this short list of Frequently Asked Questions. We hope they will help you to be successful using the <a href=\"https:\/\/owasp.org\/\">OWASP<\/a> rule set to secure your <a href=\"https:\/\/openlitespeed.org\/\">OpenLiteSpeed<\/a> server!<\/p>\n<h2>How do I set up OWASP with OpenLiteSpeed?<\/h2>\n<p>OWASP, or Open Web Application Security Project, provides a comprehensive collection of mod_security rules to protect your server. There are three ways to start using OWASP with OpenLiteSpeed (OLS). Choose the method that applies to your configuration.<\/p>\n<p>When your OLS is a cloud image, was installed using ols1clk, or was installed using the LiteSpeed repo, you can set up OWASP with the following command:<\/p>\n<pre>bash &lt;( curl -k https:\/\/raw.githubusercontent.com\/litespeedtech\/ols1clk\/master\/ols1clk.sh ) --owasp-enable\n<\/pre>\n<p>If you\u2019re using OLS with Docker, you can use the built-in <code>bash bin\/webadmin.sh --mod_secure enable<\/code> feature to enable OWASP.<\/p>\n<p>If you have compiled OLS from source, follow <a href=\"https:\/\/openlitespeed.org\/kb\/openlitespeed-modsecurity-module\/\">the instructions in our Knowledge Base<\/a> and install OWASP manually.<\/p>\n<h2>What if mod_security doesn\u2019t exist?<\/h2>\n<p>If the <code>\/usr\/local\/lsws\/modules\/mod_security.so<\/code> file doesn\u2019t exist, you can either install it from the repository with the <code>apt-get install ols-modsecurity -y<\/code> command, or <a href=\"https:\/\/openlitespeed.org\/kb\/openlitespeed-modsecurity-module\/#Method_3_Build_from_source\">build it from source<\/a>.<\/p>\n<h2>Is syntax causing my problem?<\/h2>\n<p>It\u2019s common for configuration syntax to be an issue. Here are a few things to remember:<\/p>\n<ul>\n<li>Even if <strong>Enable Module<\/strong> is set to <code>Yes<\/code>, you still need to set <strong>Modsecurity<\/strong> <code>ON<\/code>.<\/li>\n<li>When you are adding custom rules to the <strong>Modsecurity_rules<\/strong> block, be sure that they are enclosed inside of a backtick (<code>`<\/code>)<\/li>\n<\/ul>\n<h2>How do I verify if OWASP works?<\/h2>\n<p>You can test the effectiveness of an OWASP rule by trying to break it. For example, try some Cross Site Scripting on your domain:<\/p>\n<pre>http:\/\/example.com\/?user=&lt;script&gt;alert(123)&lt;\/script&gt;\n<\/pre>\n<p>If the OWASP rule is working correctly, the server will return a 403` code, and the following error message will be appended to the server error log:<\/p>\n<pre>[Module:mod_security] ModSecurity: Warning. detected XSS using libinjection. [file \"\/usr\/local\/lsws\/conf\/owasp\/owasp-modsecurity-crs\/rules\/REQUEST-941-APPLICATION-ATTACK-XSS.conf\"] [line \"38\"] [id \"941100\"]\n<\/pre>\n<p>You can try other simple test cases, such as:<\/p>\n<ul>\n<li>Classic SQL Injection:\n<pre>http:\/\/www.example.com\/?Username='1' OR '1' = '1' AND Password='1' OR '1' = '1'\n<\/pre>\n<\/li>\n<li>Select Statement:\n<pre>http:\/\/www.example.com\/?id=10 AND 1=2\n<\/pre>\n<\/li>\n<\/ul>\n<p>For each test, verify that the appropriate error message was logged.<\/p>\n<p>There is much more to OWASP testing than this, so consider taking a look at <a href=\"https:\/\/owasp.org\/www-project-web-security-testing-guide\/v42\/\">OWASP\u2019s official testing guide<\/a> for more ideas.<\/p>\n<h2>What if I am seeing false positives?<\/h2>\n<p>If you are experiencing false positives, first make sure that you are using the <a href=\"https:\/\/github.com\/coreruleset\/coreruleset\/tags\">most recent Core Rule Set<\/a> version.<\/p>\n<p>Then, if the false positives continue, you can <a href=\"https:\/\/github.com\/coreruleset\/coreruleset\/issues\">raise an issue<\/a> on the official Core Rule Set repo.<\/p>\n<p>To keep a particular false positive from impacting access to your site, you might want to comment out the rule to keep it from firing.<\/p>\n<p>For example, let\u2019s say you have the following in your server\u2019s error log, but it is a false positive:<\/p>\n<pre>[Module:mod_security] ModSecurity: Warning. detected XSS using libinjection. [file \"\/usr\/local\/lsws\/conf\/owasp\/owasp-modsecurity-crs\/rules\/REQUEST-941-APPLICATION-ATTACK-XSS.conf\"] [line \"38\"] [id \"941100\"]\n<\/pre>\n<p>Edit the configuration file found at <code>\/usr\/local\/lsws\/conf\/owasp\/owasp-modsecurity-crs\/rules\/REQUEST-941-APPLICATION-ATTACK-XSS.conf<\/code> and comment out every line of the <code>941100<\/code> rule, like so:<\/p>\n<pre># SecRule REQUEST_COOKIES|!REQUEST_COOKIES:\/__utm\/|REQUEST_COOKIES_NAMES|REQUEST_HEADERS:User-Agent|ARGS_NAMES|ARGS|XML:\/* \"@detectXSS\" \\\n    # \"id:941100,\\\n    # phase:2,\\\n    # block,\\\n    # t:none,t:utf8toUnicode,t:urlDecodeUni,t:htmlEntityDecode,t:jsDecode,t:cssDecode,t:removeNulls,\\\n    # msg:'XSS Attack Detected via libinjection',\\\n    # logdata:'Matched Data: XSS data found within %{MATCHED_VAR_NAME}: %{MATCHED_VAR}',\\\n    # tag:'application-multi',\\\n    # tag:'language-multi',\\\n    # tag:'platform-multi',\\\n    # tag:'attack-xss',\\\n    # tag:'paranoia-level\/1',\\\n    # tag:'OWASP_CRS',\\\n    # tag:'capec\/1000\/152\/242',\\\n    # ctl:auditLogParts=+E,\\\n    # ver:'OWASP_CRS\/3.3.5',\\\n    # severity:'CRITICAL',\\\n    # setvar:'tx.xss_score=+%{tx.critical_anomaly_score}',\\\n    # setvar:'tx.anomaly_score_pl1=+%{tx.critical_anomaly_score}'\"\n<\/pre>\n<p>Restart the server, and that rule will no longer fire.<\/p>\n<h2>Conclusion<\/h2>\n<p>OpenLiteSpeed and OWASP are a powerful combination for securing your server. If you have a busy server, try the more performant, highly scalable <a href=\"https:\/\/lswp.store\/2021\/02\/22\/asynchronous-modsecurity-engine\/\">proprietary mod_security engine<\/a> that comes with LiteSpeed Enterprise Web Server.<\/p>\n<p>Thank you to <a href=\"https:\/\/lswp.store\/author\/eleu\/\">Eric Leu<\/a> for providing most of the information in this article.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>We&#8217;ve compiled this short FAQ to help you be successful using OWASP with OpenLiteSpeed to secure your server.<\/p>\n","protected":false},"author":1,"featured_media":12733,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_jetpack_memberships_contains_paid_content":false,"footnotes":""},"categories":[29,23],"tags":[190,213],"class_list":["post-12731","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-openlitespeed","category-security","tag-mod_security","tag-owasp"],"jetpack_featured_media_url":"https:\/\/lswp.store\/wp-content\/uploads\/2023\/11\/ols-owasp.png","jetpack_sharing_enabled":true,"_links":{"self":[{"href":"https:\/\/lswp.store\/index.php\/wp-json\/wp\/v2\/posts\/12731","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/lswp.store\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/lswp.store\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/lswp.store\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/lswp.store\/index.php\/wp-json\/wp\/v2\/comments?post=12731"}],"version-history":[{"count":0,"href":"https:\/\/lswp.store\/index.php\/wp-json\/wp\/v2\/posts\/12731\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/lswp.store\/index.php\/wp-json\/wp\/v2\/media\/12733"}],"wp:attachment":[{"href":"https:\/\/lswp.store\/index.php\/wp-json\/wp\/v2\/media?parent=12731"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/lswp.store\/index.php\/wp-json\/wp\/v2\/categories?post=12731"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/lswp.store\/index.php\/wp-json\/wp\/v2\/tags?post=12731"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}