* dont load .gdbinit if it is world writable
@ 2007-03-04 23:08 Mike Frysinger
2007-03-05 1:45 ` Daniel Jacobowitz
0 siblings, 1 reply; 3+ messages in thread
From: Mike Frysinger @ 2007-03-04 23:08 UTC (permalink / raw)
To: gdb-patches
[-- Attachment #1.1: Type: text/plain, Size: 473 bytes --]
attached patch checks to see if the $PWD/.gdbinit file is world writable and
if so, warn about this and refuse to load it
idea being that since you can execute just about anything in it, you dont want
random people inserting this in it
of course, the usefulness of this is marginalized if .gdbinit is owned by a
diff user and they just make it world readable but not world writable ... but
i dont think a cwdbuf.st_uid == getuid() would be accepted ?
-mike
[-- Attachment #1.2: Type: application/pgp-signature, Size: 827 bytes --]
[-- Attachment #2: gdb-dont-load-world-writable-gdbinit.patch --]
[-- Type: text/x-diff, Size: 691 bytes --]
2007-03-04 Mike Frysinger <vapier@gentoo.org>
* main.c: Check if .gdbinit is world writable.
--- main.c 9 Jan 2007 21:34:29 -0000 1.62
+++ main.c 4 Mar 2007 22:59:00 -0000
@@ -763,7 +763,14 @@ extern int gdbtk_test (char *);
|| memcmp ((char *) &homebuf, (char *) &cwdbuf, sizeof (struct stat)))
if (!inhibit_gdbinit)
{
- catch_command_errors (source_script, gdbinit, 0, RETURN_MASK_ALL);
+ if (cwdbuf.st_mode & S_IWOTH)
+ {
+ warning (_("Refusing to load world writable gdbinit `%s'.\n"), gdbinit);
+ }
+ else
+ {
+ catch_command_errors (source_script, gdbinit, 0, RETURN_MASK_ALL);
+ }
}
for (i = 0; i < ncmd; i++)
^ permalink raw reply [flat|nested] 3+ messages in thread* Re: dont load .gdbinit if it is world writable
2007-03-04 23:08 dont load .gdbinit if it is world writable Mike Frysinger
@ 2007-03-05 1:45 ` Daniel Jacobowitz
2007-03-05 2:38 ` Mike Frysinger
0 siblings, 1 reply; 3+ messages in thread
From: Daniel Jacobowitz @ 2007-03-05 1:45 UTC (permalink / raw)
To: Mike Frysinger; +Cc: gdb-patches
On Sun, Mar 04, 2007 at 06:08:02PM -0500, Mike Frysinger wrote:
> attached patch checks to see if the $PWD/.gdbinit file is world writable and
> if so, warn about this and refuse to load it
>
> idea being that since you can execute just about anything in it, you dont want
> random people inserting this in it
>
> of course, the usefulness of this is marginalized if .gdbinit is owned by a
> diff user and they just make it world readable but not world writable ... but
> i dont think a cwdbuf.st_uid == getuid() would be accepted ?
You can find my more thorough patch for this in the archives, from
late May 2006. There was some feedback (to be honest I completely
don't remember what it was) and I never got back to it. I think Red
Hat has a different patch for it in their RPMS, too.
--
Daniel Jacobowitz
CodeSourcery
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: dont load .gdbinit if it is world writable
2007-03-05 1:45 ` Daniel Jacobowitz
@ 2007-03-05 2:38 ` Mike Frysinger
0 siblings, 0 replies; 3+ messages in thread
From: Mike Frysinger @ 2007-03-05 2:38 UTC (permalink / raw)
To: Daniel Jacobowitz; +Cc: gdb-patches
[-- Attachment #1: Type: text/plain, Size: 1042 bytes --]
On Sunday 04 March 2007, Daniel Jacobowitz wrote:
> On Sun, Mar 04, 2007 at 06:08:02PM -0500, Mike Frysinger wrote:
> > attached patch checks to see if the $PWD/.gdbinit file is world writable
> > and if so, warn about this and refuse to load it
> >
> > idea being that since you can execute just about anything in it, you dont
> > want random people inserting this in it
> >
> > of course, the usefulness of this is marginalized if .gdbinit is owned by
> > a diff user and they just make it world readable but not world writable
> > ... but i dont think a cwdbuf.st_uid == getuid() would be accepted ?
>
> You can find my more thorough patch for this in the archives, from
> late May 2006. There was some feedback (to be honest I completely
> don't remember what it was) and I never got back to it. I think Red
> Hat has a different patch for it in their RPMS, too.
ah i had searched but hadnt found that one since it dated so old (June 2005:
RFC: Check permissions of .gdbinit files)
thanks for the pointer
-mike
[-- Attachment #2: Type: application/pgp-signature, Size: 827 bytes --]
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2007-03-05 2:38 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2007-03-04 23:08 dont load .gdbinit if it is world writable Mike Frysinger
2007-03-05 1:45 ` Daniel Jacobowitz
2007-03-05 2:38 ` Mike Frysinger
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox