logo

Database

Javascript Kony Browser Html String

Description

Detects potentially unsafe HTML string configurations in Kony UI Browser components that could enable Cross-Site Scripting (XSS) attacks. When browser components are initialized with unvalidated HTML content, attackers could inject malicious scripts that execute in the browser context.

Weakness:

045 - HTML code injection

Category: Unexpected Injection

Detection Strategy

    • Look for Kony UI Browser component initialization calls (kony.ui.Browser)

    • Examine the first argument passed to the Browser constructor

    • Check if the configuration object contains unsafe HTML string content or unvalidated dynamic content

    • Flag instances where browser content is not properly sanitized or validated before rendering

Vulnerable code example

function displayUserContent() {
    var userInput = frmMain.userTextField.text;  // Untrusted user input from form field
    var browser = new kony.ui.Browser({
        id: "contentBrowser",
        isVisible: true,
        htmlString: userInput  // VULNERABLE: Raw user input directly used in HTML context
    }, { 
        containerHeight: 100 ...

✅ Secure code example

function displayUserContent() {
    var userInput = frmMain.userTextField.text;
    
    // Option 1: Encode user input to prevent XSS
    var encodedContent = kony.string.escapeHTML(userInput); // Sanitize user input
    var browser = new kony.ui.Browser({
        id: "contentBrowser",
        isVisible: true,...