(Sorry to not write C, but I think the scenario is easier to demonstrate out in the shell.)ĭrwx-x-x 2 bob users 4096 Sep 17 11:19. But a few techniques might help obscure what and where your app is saving things, if that matters.Ĭonsider two users doing some shell commands like the following in a directory with its sticky bit set (say /tmp). Prepending a '.' to a file name helps in some important contexts (default ls(1) behavior and shell * globbing in particular) but only goes so far. Keep in mind that Unix-like systems don't really do hidden when the resource involved needs to remain visible (readable, presumably), as others have noted. Do you expect other users (of your program? in general?) to be able to read it, but not find it easily, or modify or delete it? Your requirements are a bit vague: the program creates a file, wants to prevent its removal or modification. To counter this, some programs modify control characters (such as find and ls) - making it even harder to correctly handle files with such names. A filename with embedded control characters can (when displayed) cause function keys to be renamed, set X atoms, change displays in misleading ways, and so on. Moore’s “Terminal Emulator Security Issues” (2003) summarizes some of the security issues modern terminal emulators try to disable the most dangerous ones, but they can still cause trouble. The GNU ls program tries to protect users from this effect by default (see the -N option), but many people display filenames without getting filtered by ls - and the problem returns. Most software developers don’t understand that merely displaying filenames can cause security problems if they can contain control characters. Terminals (like xterm, gnome-terminal, the Linux console, etc.) implement control sequences. Some control characters, particularly the escape (ESC) character, can cause all sorts of display problems, including security problems. See Control characters in filenames are a terrible idea: as others already mentioned.Īnyway, you can experiment with putting control characters like new-line into the filename. Some tools don't show files starting with.
0 Comments
Leave a Reply. |