XrmToolBox icon indicating copy to clipboard operation
XrmToolBox copied to clipboard

Update StoreFormFromPortal.cs - Issue #1331 Fix

Open TaranYourAss opened this issue 1 year ago • 1 comments

What is being changed

Adding check to make sure loaded URLs from a plugins 'Project Url" are actual URLs when a user clicks on the loaded 'Project Url' within the Tool Library page. With this change, any user that clicks on a plugin 'Project Url' that fails the Uri check, the Process.Start() function will not be called.

Found the code from: https://stackoverflow.com/questions/7578857/how-to-check-whether-a-string-is-a-valid-http-url

This will just prevent any non-urls from being executed in the Process.Start() function - preventing any potential for command injection found in Issue #1331.

How command injection occurs

Fundamentally command injection can occur when the 'Project Url' for a plugin contains commands instead of a URL and the user clicks on the 'Project Url' for a plugin in the Tool Library page. As the current version of XrmToolBox does not sanitize or check the URL from plugins loaded from the XrmToolBox portal, there are a few ways a malicious actor could utilize this flaw to execute arbitrary commands on users machines:

  1. A malicious plugin with commands stored in its 'Project Url' is successfully added to the XrmToolBox Portal and loaded into users Tool Library. image

  2. A man-in-the-middle attack occurs, intercepting the request to www.xrmtoolbox.com/_odata/plugins, and replacing specific or all mctools_projecturl data with arbitrary commands image

What loaded commands will look like from a man-in-the-middle attack: image

TaranYourAss avatar Apr 11 '24 17:04 TaranYourAss

https://github.com/MscrmTools/XrmToolBox/assets/65303833/820703e1-d346-493a-a1c1-5b84348db52f

TaranYourAss avatar Apr 12 '24 05:04 TaranYourAss

Thank you! I'm adding your change

MscrmTools avatar Jul 15 '24 15:07 MscrmTools