Skip to content

Free memory before running psfree #61

@mrdude2478

Description

@mrdude2478

In PSFree we can clear some browser memory in async function main() before starting to exploit.

First create a function to clear some memory:

async function forceGC() {
    try {
        for (let i = 0; i < 10; i++) {
            let junk = new Array(10000).fill(0);
            junk = null;
            await new Promise(resolve => setTimeout(resolve, 10)); // Give browser time to GC
        }
    }
    catch (err) {
        log("Failed to free memory");
    }
}

In the first line of async function main(), we call the function:

await forceGC();

This clears some browser memory before the exploit starts so we get less chance of out of memory error.

I tried by creating an html file to load a large jpeg before starting the exploit, this would cause a memory error when trying to run psfree, with the added function, this reduced this error quite a bit and so I thought I'd pass on the information if you want to test it.
You can increase the amount you clear by altering this line - (let i = 0; i < 10; i++), increase10 to 20/30 etc...

I have mine set to 50 and that works quite well for me.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions