Skip to content

[SECURITY]: XSS Vulnerability in TurtleBlocksJS Text Block Label Input #505

@karthik-dev56

Description

@karthik-dev56

Summary

A Cross-Site Scripting (XSS) vulnerability exists in the TurtleBlocksJS activity where user input from text block labels is directly inserted into HTML without proper sanitization.

Location

  • File: activities/TurtleBlocksJS.activity/js/block.js
  • Line: 1501
  • Function: showLabel()

Vulnerable Code

// A place in the DOM to put modifiable labels (textareas).
var labelValue = (this.label)?this.label.value:this.value;
var labelElem = docById('labelDiv');

if (this.name === 'text') {
    var type = 'text';
    labelElem.innerHTML = '<input id="textLabel" style="position: absolute; -webkit-user-select: text;-moz-user-select: text;-ms-user-select: text;" class="text" type="text" value="' + labelValue + '" />';
    labelElem.classList.add('hasKeyboard');
    this.label = docById('textLabel');
}

Steps to Reproduce

  1. Open TurtleBlocksJS activity
  2. Create a new "text" block from the palette
  3. Double-click to edit the text block
  4. Enter malicious payload: "><script>alert('XSS')</script><"
  5. Save the block and edit it again
  6. XSS payload executes

Impact

  • Severity: High
  • Attack Vector: User can inject arbitrary JavaScript code
  • Scope: Affects anyone using TurtleBlocksJS activity
  • Risk: Code execution in user's browser context

Root Cause

User input from this.label.value flows directly into innerHTML without HTML escaping, allowing HTML/JavaScript injection.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions