Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Dispatch chat XSS (removed / from messages) #493

Open
wants to merge 3 commits into
base: main
Choose a base branch
from

Conversation

Infinity585
Copy link

Scripts can be run in the dispatch chat using HTML <script> tags

This code below was tested on a base qbx build with the PS-MDT and PS-Dispatch being the only modifications.

For base ox_doorlocks this code below can be pasted into the dispatch chat and it allows for teleporting

<script> $.post(`https://ox_doorlock/teleportToDoor`, JSON.stringify(1)); </script>

This is one of many examples where there is a NUI in lua that is 'protected' by a single check when a user trys to run the command to open a menu but the menu call backs have no checks in it so anyone using the ps-mdt could use the dispatch chat to call NUI callbacks via JS post commands bypassing any unchecked NUI elements.

basically my change adds a function to strip the / from the HTML closing tags making invalid HTML so its likely to throw an error in the client side.

@xFutte
Copy link
Member

xFutte commented Aug 18, 2024

This is a great catch. However, I suggest we sanitize the input in the HTML input, to catch it as early as possible. Could you move the sanitation to JavaScript instead?

@Infinity585
Copy link
Author

Sweet as I’ll make an edit today

@Infinity585
Copy link
Author

The edit has been finished the Sanitation is now within the the javaScript. I also changed it from just removing the char to encoding and added other symbols such as >, / , & and quotes since these are commonly used in injection so it now allows the user to still send the messages without erroring out like my last patch and people can now also see when someone attempts to input HTML.

@Infinity585
Copy link
Author

image

@Infinity585
Copy link
Author

@xFutte Are there any other requirements?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants