Ren'Py zip distributions contain world-writable files.

In this forum we discuss the future of Ren'Py, both bug fixes and longer-term development. Pre-releases are announced and discussed here.
Post Reply
Message
Author
Spiky Caterpillar
Veteran
Posts: 253
Joined: Fri Nov 14, 2008 7:59 pm
Completed: Lots.
Projects: Black Closet
Organization: Slipshod
Location: Behind you.
Contact:

Ren'Py zip distributions contain world-writable files.

#1 Post by Spiky Caterpillar »

When Ren'Py creates a zipfile, it sets the permissions for the zip members to be 666 or 777. Info-zip's unzip program overrides the user's umask when decompressing by default, so *any* code running on the same computer can modify game files if it can read the directory that they were extracted into, and thus gain access to the account that the user is playing the game in. Apple (confirmed in Lion and Jaguar), Debian (confirmed in Wheezy), and the upstream source all ship vulnerable versions of unzip.

You should be able to patch old Ren'Py versions by finding where in the launcher the zip members' external attributes are set - lines like:

Code: Select all

                zi.external_attr = long(0100777) << 16
                zi.external_attr = long(0100666) << 16 
            zi.external_attr = (long(0040777) << 16) | 0x10
and changing the 777s and 666s to 755 and 644 respectively. It's only important to change on zips - Linux tar.bz2 archives also have mode 666/777, but the Linux tar program (at least on Debian) honours umasks properly so they. Note that all-architecture zip distributions and Windows zip distributions being played using Wine *DO* have vulnerable permissions.
Nom nom nom nom nom LEAVES.

User avatar
PyTom
Ren'Py Creator
Posts: 16096
Joined: Mon Feb 02, 2004 10:58 am
Completed: Moonlight Walks
Projects: Ren'Py
IRC Nick: renpytom
Github: renpytom
itch: renpytom
Location: Kings Park, NY
Contact:

Re: Ren'Py zip distributions contain world-writable files.

#2 Post by PyTom »

I'll make this change in the next release of Ren'Py - I'm tracking the issue here: https://github.com/renpy/renpy/issues/104

Are they going to be fixing this in info-zip? It seems like a major bug that could affect a lot of software, not just Ren'Py.
Supporting creators since 2004
(When was the last time you backed up your game?)
"Do good work." - Virgil Ivan "Gus" Grissom
Software > Drama • https://www.patreon.com/renpytom

Spiky Caterpillar
Veteran
Posts: 253
Joined: Fri Nov 14, 2008 7:59 pm
Completed: Lots.
Projects: Black Closet
Organization: Slipshod
Location: Behind you.
Contact:

Re: Ren'Py zip distributions contain world-writable files.

#3 Post by Spiky Caterpillar »

Excellent, thanks.

It looks like they're planning to fix it in info-zip as well. (And searching my own computer for zips with world-writable files turned up several non-Ren'Py-generated files.)
Nom nom nom nom nom LEAVES.

Post Reply

Who is online

Users browsing this forum: No registered users