/sys/uid.sys

From WiiBrew
Jump to navigation Jump to search
/sys/uid.sys
TypeGeneric file
OwnerIOS
Group ID0

/sys/uid.sys is a list of TitleID-UID pairs. UIDs are used for ownership on the Wii filesystem.

The first entry in the file is always the System Menu, with UID 0x1000. UIDs iterate from that number. It may not be necessary for the first entry to be 1-2/0x1000, but it's probably a good idea to keep it that way.

On the filesystem, ownership is normally used to gives titles access to their "data" directories.

uid.sys is often used by homebrewers to have a record of what titles have been installed on a console (and the order they were loaded), as IOS does not remove title IDs from this table when it deletes titles.

Creation

This file would probably be created by any IOS when attempting to install a title if it does not already exist, however, in practice, it is created by boot2v0 when it loads the 1-2 title for the first time, to assign this title a UID of 0x1000.

File structure

typedef struct
{
	u64 title_id;
	u16 padding;
	u16 uid;
} entry;

typedef entry uidsys[]; // any number of entries

Buffer overflow

When reading this file, ES allocates a buffer of size 0xC (the size of a single entry), then reads the entire file to the location of that buffer. It is not known if this can be exploited, due to the difficulty in writing to uid.sys in addition to the requirement of needing to write to the end.