{"id":17916,"date":"2022-02-25T17:10:40","date_gmt":"2022-02-25T16:10:40","guid":{"rendered":"https:\/\/herolab.usd.de\/?page_id=17916"},"modified":"2022-03-03T11:11:19","modified_gmt":"2022-03-03T10:11:19","slug":"usd-2021-0019","status":"publish","type":"page","link":"https:\/\/herolab.usd.de\/en\/security-advisories\/usd-2021-0019\/","title":{"rendered":"usd-2021-0019"},"content":{"rendered":"\n\n\n\n\n\n[et_pb_section fb_built=\"1\" _builder_version=\"4.9.4\" _module_preset=\"default\" background_color=\"#2E353D\" custom_padding=\"||0px|||\" global_colors_info=\"{}\"][et_pb_row _builder_version=\"4.9.4\" _module_preset=\"default\" global_colors_info=\"{}\"][et_pb_column type=\"4_4\" _builder_version=\"4.9.4\" _module_preset=\"default\" global_colors_info=\"{}\"][et_pb_text _builder_version=\"4.13.1\" _module_preset=\"cc5ac6f4-ebbd-4b3f-bc92-4dfc1f15fe2c\" global_colors_info=\"{}\"]<h1>usd-2021-0019 | Zulip<\/h1>\n<p><strong>Advisory ID<\/strong>: usd-2021-0019<br \/><strong>Affected Product<\/strong>: Zulip<br \/><strong>Affected Version<\/strong>:\u00a0 &lt;= Zulip Server 4.7<br \/><strong>Vulnerability Type<\/strong>: CWE-918: Server-Side Request Forgery (SSRF)<br \/><strong>Security Risk<\/strong>: Medium<br \/><strong>Vendor URL<\/strong>: <a href=\"https:\/\/zulip.com\/\" target=\"_blank\" rel=\"noopener\">https:\/\/zulip.com\/<\/a> <a href=\"https:\/\/www.microsoft.com\/\" target=\"_blank\" rel=\"noopener\">\u00a0<\/a><br \/><strong>Vendor Status<\/strong>: <em>Fixed<\/em><\/p>\n<p><span><\/span><\/p>\n<p><em>With the release of <a href=\"https:\/\/blog.zulip.com\/2021\/05\/13\/zulip-4-0-released\/\" target=\"_blank\" rel=\"noopener\">Zulip 4.0<\/a> an optional mitigation against SSRF was introduced, which was disabled by default until the release of <a href=\"https:\/\/blog.zulip.com\/2021\/12\/01\/zulip-server-4-8-security-release\/\" target=\"_blank\" rel=\"noopener\">Zulip 4.8<\/a>. It is highly recommended to update to the latest version of Zulip, because older versions (in their default configuration) may be vulnerable to SSRF due to their configuration. Also, the configuration of Smokescreen was optional.<\/em><br \/><span><\/span><\/p>\n<h3><\/h3>\n<h3><\/h3>\n<h3>Description<\/h3>\n<p>For Zulip &lt;= 4.7 (default configuration), it is possible to use the outgoing webhook feature of bots in order to scan open ports of the Zulip server (localhost) and other systems on the internal network.<\/p>\n<p>The application is vulnerable to server-side request forgery (SSRF) attacks and can therefore be made to perform requests to other services. From the perspective of those other services it looks like the requests originated from the vulnerable application. It is possible to use the outgoing webhook feature of bots in order to scan open ports of the Zulip server (localhost) and other systems on the internal network. An open port can be differentiated from a closed one by observing the time delay between talking to a bot and receiving the \"Failure! Bot is unavailable\" error message.<\/p>\n<p><span><\/span><\/p>\n<h3>Proof of Concept (PoC)<\/h3>\n<p>The SSRF to localhost can be proven as follows:<\/p>\n<p>1. Create two new bots at https:\/\/&lt;your-zulip-instance&gt;\/#settings\/your-bots. Name one of the bots \"openPortLocalhost\" and set the Endpoint URL to <strong>http:\/\/localhost:8765<\/strong>:<\/p>[\/et_pb_text][et_pb_image src=\"https:\/\/herolab.usd.de\/wp-content\/uploads\/sites\/9\/2021\/11\/ssrf-localhost-1.png\" title_text=\"ssrf-localhost-1\" _builder_version=\"4.13.1\" _module_preset=\"default\" global_colors_info=\"{}\"][\/et_pb_image][et_pb_text _builder_version=\"4.13.1\" _module_preset=\"cc5ac6f4-ebbd-4b3f-bc92-4dfc1f15fe2c\" custom_margin=\"||27px||false|false\" custom_padding=\"||0px|||\" global_colors_info=\"{}\"]<p>Name the other bot \"closedPortLocalhost\" and set the endpoint to <strong>http:\/\/localhost:&lt;known closed port&gt;<\/strong>.<\/p>\n<p>2. Open a port on localhost:<\/p>[\/et_pb_text][et_pb_text _builder_version=\"4.9.4\" _module_preset=\"9e260d37-0be2-4a12-a10e-3ed7e27b6ac6\" global_colors_info=\"{}\"]<pre class=\"x-code\">$ nc -lvp 8765<\/pre>[\/et_pb_text][et_pb_text _builder_version=\"4.13.1\" _module_preset=\"cc5ac6f4-ebbd-4b3f-bc92-4dfc1f15fe2c\" custom_margin=\"||27px||false|false\" global_colors_info=\"{}\"]<p>3. Trigger <strong>openPortLocalhost<\/strong>\u00a0for which you opened a port on localhost:<\/p>[\/et_pb_text][et_pb_image src=\"https:\/\/herolab.usd.de\/wp-content\/uploads\/sites\/9\/2021\/11\/ssrf-localhost-2.png\" title_text=\"ssrf-localhost-2\" _builder_version=\"4.13.1\" _module_preset=\"default\" global_colors_info=\"{}\"][\/et_pb_image][et_pb_text _builder_version=\"4.13.1\" _module_preset=\"cc5ac6f4-ebbd-4b3f-bc92-4dfc1f15fe2c\" custom_margin=\"||27px||false|false\" global_colors_info=\"{}\"]<p>4. Observe the incoming HTTP request:<\/p>[\/et_pb_text][et_pb_image src=\"https:\/\/herolab.usd.de\/wp-content\/uploads\/sites\/9\/2021\/11\/ssrf-localhost-3.png\" title_text=\"ssrf-localhost-3\" _builder_version=\"4.13.1\" _module_preset=\"default\" global_colors_info=\"{}\"][\/et_pb_image][et_pb_text _builder_version=\"4.13.1\" _module_preset=\"cc5ac6f4-ebbd-4b3f-bc92-4dfc1f15fe2c\" custom_margin=\"||27px||false|false\" global_colors_info=\"{}\"]<p>5. Wait for a couple of minutes before killing the Netcat process with <em>Ctrl+C.<\/em><\/p>\n<p>6. Observe the time difference between `openPortLocalhost` was called and the \"Failure! Bot is unavailable\" error message was received.<\/p>\n<p>7. Trigger <strong>closedPortLocalhost<\/strong>:<\/p>[\/et_pb_text][et_pb_image src=\"https:\/\/herolab.usd.de\/wp-content\/uploads\/sites\/9\/2021\/11\/ssrf-localhost-2-1.png\" title_text=\"ssrf-localhost-2\" _builder_version=\"4.13.1\" _module_preset=\"default\" global_colors_info=\"{}\"][\/et_pb_image][et_pb_text _builder_version=\"4.13.1\" _module_preset=\"cc5ac6f4-ebbd-4b3f-bc92-4dfc1f15fe2c\" custom_margin=\"||27px||false|false\" global_colors_info=\"{}\"]<p>8. Observe the time difference between `closedPortLocalhost` was called and the \"Failure! Bot is unavailable\" error message was received.<\/p>\n<p>9. Compare the response times of calling the two different bots. The error message for <strong>openPortLocalhost<\/strong> is received shortly after killing the Netcat process (step 5), while the error message for <strong>closedPortLocalhost<\/strong> is received almost instantly.<\/p>\n<p><br \/>The following screenshots illustrate the blind SSRF to the internal network:<\/p>[\/et_pb_text][et_pb_image src=\"https:\/\/herolab.usd.de\/wp-content\/uploads\/sites\/9\/2022\/02\/POC_localhost_zulip_1-no-users.png\" title_text=\"POC_localhost_zulip_1-no-users\" _builder_version=\"4.14.7\" _module_preset=\"default\" hover_enabled=\"0\" global_colors_info=\"{}\" sticky_enabled=\"0\"][\/et_pb_image][et_pb_image src=\"https:\/\/herolab.usd.de\/wp-content\/uploads\/sites\/9\/2021\/11\/ssrf-other-2.png\" title_text=\"ssrf-other-2\" _builder_version=\"4.13.1\" _module_preset=\"default\" global_colors_info=\"{}\"][\/et_pb_image][et_pb_text _builder_version=\"4.13.1\" _module_preset=\"cc5ac6f4-ebbd-4b3f-bc92-4dfc1f15fe2c\" global_colors_info=\"{}\"]<div class=\"e16902-22 x-container max width\">\n<div class=\"e16902-23 x-column x-sm x-1-1\">\n<h3>Fix<\/h3>\n<p>With the release of <a href=\"https:\/\/blog.zulip.com\/2021\/05\/13\/zulip-4-0-released\/\" target=\"_blank\" rel=\"noopener\">Zulip 4.0<\/a> an optional mitigation against SSRF was introduced. Zulip now allows to configure <em>Smokescreen,<\/em> \"<span>an open-source proxy developed by Stripe to protect a service with\u00a0<\/span><a href=\"https:\/\/zulip.com\/api\/outgoing-webhooks\" target=\"_blank\" rel=\"noopener\">outgoing webhooks<\/a><span>\u00a0from being used to make\u00a0<\/span><a href=\"https:\/\/portswigger.net\/web-security\/ssrf\" target=\"_blank\" rel=\"noopener\">SSRF attacks<\/a><span> against other services\". Since <a href=\"https:\/\/blog.zulip.com\/2021\/12\/01\/zulip-server-4-8-security-release\/\" target=\"_blank\" rel=\"noopener\">Zulip 4.8<\/a> <em>Smokescreen<\/em> is enabled by default. Thus, it is highly recommended to update to the most-recent version of Zulip.<\/span><\/p>\n<p>\u00a0<span style=\"font-size: 16px\">Generally, it is recommended to evaluate the need to make server-side requests. If server-side requests are absolutely necessary, the corresponding function should be ideally restricted by a whitelisting approach.<\/span><\/p>\n<h3><\/h3>\n<h3>References<\/h3>\n<ul>\n<li><a href=\"https:\/\/zulip.readthedocs.io\/en\/latest\/production\/requirements.html\" target=\"_blank\" rel=\"noopener\">https:\/\/zulip.readthedocs.io\/en\/latest\/production\/requirements.html<\/a><\/li>\n<li><a href=\"https:\/\/blog.zulip.com\/2021\/12\/01\/zulip-server-4-8-security-release\/\" target=\"_blank\" rel=\"noopener\">https:\/\/blog.zulip.com\/2021\/12\/01\/zulip-server-4-8-security-release\/<\/a>\u00a0<\/li>\n<li><a href=\"https:\/\/cwe.mitre.org\/data\/definitions\/918.html\" target=\"_blank\" rel=\"noopener\">https:\/\/cwe.mitre.org\/data\/definitions\/918.html<\/a><\/li>\n<li><a href=\"https:\/\/owasp.org\/www-community\/attacks\/Server_Side_Request_Forgery\" target=\"_blank\" rel=\"noopener\">https:\/\/owasp.org\/www-community\/attacks\/Server_Side_Request_Forgery<\/a><\/li>\n<\/ul>\n<h3><\/h3>\n<h3>Timeline<\/h3>\n<ul>\n<li>\n<p data-pm-slice=\"1 1 []\">2021-04-30: vulnerability identified by Marcus Nilsson.<\/p>\n<\/li>\n<li>\n<p data-pm-slice=\"1 1 []\"><span data-asana-object=\"1\" data-object-id=\"1185012938240974\" data-preferred-path=\"\/0\/1185012938240974\/list\"><\/span>2021-05-05: Initial contact via <a href=\"mailto:security@zulip.com\">security@zulip.com<\/a>.<\/p>\n<\/li>\n<li>\n<p data-pm-slice=\"1 1 []\">2021-05-06: Vulnerability details submitted.<\/p>\n<\/li>\n<li>\n<p data-pm-slice=\"1 1 []\"><span style=\"font-size: 16px\">2021-05-18: Status update requested.<\/span><\/p>\n<\/li>\n<li>2021-05-20: Zulip responds and asks to verify the findings against the recently published version 4.0 including the introduced <em>Smokescreen<\/em> setup.<span style=\"font-size: 16px\"><\/span><\/li>\n<li>2021-07-23: usd confirms that the <em>Smokescreen<\/em> setup mitigates the described SSRF vulnerability.<\/li>\n<li>2021-12-01: <a href=\"https:\/\/blog.zulip.com\/2021\/12\/01\/zulip-server-4-8-security-release\/\" target=\"_blank\" rel=\"noopener\">Zulip 4.8<\/a> is released which is not vulnerable by default against the described vulnerability anymore.<\/li>\n<li>2022-02-25: Security advisory released by usd AG.<\/li>\n<\/ul>\n<h3><\/h3>\n<h3>Credits<\/h3>\n<p>This security vulnerability was found by Marcus Nilsson of usd AG.<\/p>\n<\/div>\n<\/div>[\/et_pb_text][\/et_pb_column][\/et_pb_row][\/et_pb_section]\n\n\n\n\n\n","protected":false},"excerpt":{"rendered":"<p>usd-2021-0019 | Zulip Advisory ID: usd-2021-0019Affected Product: ZulipAffected Version:\u00a0 &lt;= Zulip Server 4.7Vulnerability Type: CWE-918: Server-Side Request Forgery (SSRF)Security Risk: MediumVendor URL: https:\/\/zulip.com\/ \u00a0Vendor Status: Fixed With the release of Zulip 4.0 an optional mitigation against SSRF was introduced, which was disabled by default until the release of Zulip 4.8. It is highly recommended to [&hellip;]<\/p>\n","protected":false},"author":96,"featured_media":17032,"parent":16124,"menu_order":0,"comment_status":"closed","ping_status":"closed","template":"","meta":{"_et_pb_use_builder":"on","_et_pb_old_content":"","_et_gb_content_width":"","inline_featured_image":false,"footnotes":""},"class_list":["post-17916","page","type-page","status-publish","has-post-thumbnail","hentry"],"_links":{"self":[{"href":"https:\/\/herolab.usd.de\/en\/wp-json\/wp\/v2\/pages\/17916","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/herolab.usd.de\/en\/wp-json\/wp\/v2\/pages"}],"about":[{"href":"https:\/\/herolab.usd.de\/en\/wp-json\/wp\/v2\/types\/page"}],"author":[{"embeddable":true,"href":"https:\/\/herolab.usd.de\/en\/wp-json\/wp\/v2\/users\/96"}],"replies":[{"embeddable":true,"href":"https:\/\/herolab.usd.de\/en\/wp-json\/wp\/v2\/comments?post=17916"}],"version-history":[{"count":0,"href":"https:\/\/herolab.usd.de\/en\/wp-json\/wp\/v2\/pages\/17916\/revisions"}],"up":[{"embeddable":true,"href":"https:\/\/herolab.usd.de\/en\/wp-json\/wp\/v2\/pages\/16124"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/herolab.usd.de\/en\/wp-json\/wp\/v2\/media\/17032"}],"wp:attachment":[{"href":"https:\/\/herolab.usd.de\/en\/wp-json\/wp\/v2\/media?parent=17916"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}