Rocksolid Light

Welcome to novaBBS (click a section below)

mail  files  register  newsreader  groups  login

Message-ID:  

The man on tops walks a lonely street; the "chain" of command is often a noose.


devel / comp.lang.c / Re: getOpsFromSelf() (Long Post)

SubjectAuthor
* getOpsFromSelf() (Long Post)Mike Sanders
+* Re: getOpsFromSelf() (Long Post)Spiros Bousbouras
|+* Re: getOpsFromSelf() (Long Post)Spiros Bousbouras
||`* Re: getOpsFromSelf() (Long Post)Mike Sanders
|| +* Re: getOpsFromSelf() (Long Post)Keith Thompson
|| |`* Re: getOpsFromSelf() (Long Post)Mike Sanders
|| | `* Re: getOpsFromSelf() (Long Post)Keith Thompson
|| |  +- Re: getOpsFromSelf() (Long Post)Lew Pitcher
|| |  `* Re: getOpsFromSelf() (Long Post)dave thompson 2
|| |   `* Re: getOpsFromSelf() (Long Post)Mike Sanders
|| |    `* Re: getOpsFromSelf() (Long Post)Lew Pitcher
|| |     `- Re: getOpsFromSelf() (Long Post)Mike Sanders
|| `* Re: getOpsFromSelf() (Long Post)Spiros Bousbouras
||  `- Re: getOpsFromSelf() (Long Post)Mike Sanders
|+* Re: getOpsFromSelf() (Long Post)Mike Sanders
||+* Re: getOpsFromSelf() (Long Post)Ben Bacarisse
|||`- Re: getOpsFromSelf() (Long Post)Mike Sanders
||`* Re: getOpsFromSelf() (Long Post)Spiros Bousbouras
|| +- Re: getOpsFromSelf() (Long Post)Mike Sanders
|| +* Re: getOpsFromSelf() (Long Post)Stefan Ram
|| |+- Re: getOpsFromSelf() (Long Post)Keith Thompson
|| |`* Re: getOpsFromSelf() (Long Post)Spiros Bousbouras
|| | `- Re: getOpsFromSelf() (Long Post)Stefan Ram
|| `* Re: getOpsFromSelf() (Long Post)Stefan Ram
||  +- Re: getOpsFromSelf() (Long Post)Scott Lurndal
||  +* Re: getOpsFromSelf() (Long Post)Spiros Bousbouras
||  |`- Re: getOpsFromSelf() (Long Post)Stefan Ram
||  `- Re: getOpsFromSelf() (Long Post)David Brown
|`* Re: getOpsFromSelf() (Long Post)Scott Lurndal
| `- Re: getOpsFromSelf() (Long Post)Mike Sanders
`* Re: getOpsFromSelf() (Long Post)immibis
 `- Re: getOpsFromSelf() (Long Post)Mike Sanders

Pages:12
Re: getOpsFromSelf() (Long Post)

<uro844$383e$1@dont-email.me>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=33901&group=comp.lang.c#33901

  copy link   Newsgroups: comp.lang.c
Path: i2pn2.org!i2pn.org!eternal-september.org!feeder3.eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail
From: new...@immibis.com (immibis)
Newsgroups: comp.lang.c
Subject: Re: getOpsFromSelf() (Long Post)
Date: Wed, 28 Feb 2024 22:21:08 +0100
Organization: A noiseless patient Spider
Lines: 18
Message-ID: <uro844$383e$1@dont-email.me>
References: <ur1ie5$2cgfo$1@dont-email.me>
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 7bit
Injection-Date: Wed, 28 Feb 2024 21:21:09 -0000 (UTC)
Injection-Info: dont-email.me; posting-host="5aba75ac32f41fa1027b7412d6b902d3";
logging-data="106606"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1+4RKa1x55mm+GglbjSsQEq"
User-Agent: Mozilla Thunderbird
Cancel-Lock: sha1:5P/Wn6KD6Fdx+0XULHBtfuITPbQ=
Content-Language: en-US
In-Reply-To: <ur1ie5$2cgfo$1@dont-email.me>
 by: immibis - Wed, 28 Feb 2024 21:21 UTC

On 20/02/24 07:56, Mike Sanders wrote:
> Just thinking aloud... Imagining here allowing more advanced users of
> my app to modify a string of digits residing at the end of my project's
> binary/exe. When the app loads, it reads in those digits. So far (knock
> on wood), I've not run up against a single case where the code below has
> failed to work under multiple OSs. A method mostly for power user's.
>
> The user simply opens the compiled project in their favorite hex editor
> & modifies the pre-existing string, a pseudo bitmask of sorts. Certainly
> the user could unwittingly add/remove bytes rather than only modifying the
> bytes, still its a nifty idea. But practical? I'm not so sure on that point.
>
> Any other gotchas of note?

If they can only modify bytes, not add or remove, you can just put some
bytes anywhere in your code and the user can find them modify them with
a hex editor. You don't need to do anything special to allow someone to
modify a file in their possession.

Re: getOpsFromSelf() (Long Post)

<urr828$sk2m$1@dont-email.me>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=33967&group=comp.lang.c#33967

  copy link   Newsgroups: comp.lang.c
Path: i2pn2.org!i2pn.org!eternal-september.org!feeder3.eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail
From: porkc...@invalid.foo (Mike Sanders)
Newsgroups: comp.lang.c
Subject: Re: getOpsFromSelf() (Long Post)
Date: Fri, 1 Mar 2024 00:38:33 -0000 (UTC)
Organization: A noiseless patient Spider
Lines: 13
Sender: Mike Sanders <busybox@sdf.org>
Message-ID: <urr828$sk2m$1@dont-email.me>
References: <ur1ie5$2cgfo$1@dont-email.me> <uro844$383e$1@dont-email.me>
Injection-Date: Fri, 1 Mar 2024 00:38:33 -0000 (UTC)
Injection-Info: dont-email.me; posting-host="b71f2dfef35270dbb072913dc1bc81a5";
logging-data="938070"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX192+GN4mYvfKQ6wJF8fNZOE"
User-Agent: tin/2.6.2-20221225 ("Pittyvaich") (NetBSD/9.3 (amd64))
Cancel-Lock: sha1:aWnlKZV67Ohcb6nQlxlOWP6UCi0=
 by: Mike Sanders - Fri, 1 Mar 2024 00:38 UTC

immibis <news@immibis.com> wrote:

> If they can only modify bytes, not add or remove, you can just put some
> bytes anywhere in your code and the user can find them modify them with
> a hex editor. You don't need to do anything special to allow someone to
> modify a file in their possession.

Thanks for your input, I appreciate it.

--
:wq
Mike Sanders

Re: getOpsFromSelf() (Long Post)

<jfp4uid7emkscphducofhqdpg8jdbstnun@4ax.com>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=33994&group=comp.lang.c#33994

  copy link   Newsgroups: comp.lang.c
Path: i2pn2.org!i2pn.org!eternal-september.org!feeder3.eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail
From: dave_tho...@comcast.net
Newsgroups: comp.lang.c
Subject: Re: getOpsFromSelf() (Long Post)
Date: Fri, 01 Mar 2024 18:37:17 -0500
Organization: A noiseless patient Spider
Lines: 19
Message-ID: <jfp4uid7emkscphducofhqdpg8jdbstnun@4ax.com>
References: <ur1ie5$2cgfo$1@dont-email.me> <jh8EdBXIFQu4WLaKt@bongo-ra.co> <1HyZeCKHsTViXCSYj@bongo-ra.co> <urdmt4$1d3vr$3@dont-email.me> <87y1b9wbfs.fsf@nosuchdomain.example.com> <urf9g5$1qtds$1@dont-email.me> <87h6hww3x0.fsf@nosuchdomain.example.com>
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
Injection-Info: dont-email.me; posting-host="202b966f386bdfcc2b09005561d97d23";
logging-data="1584856"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX18O+q2Ar51kFHbyQMYAu0xYJbKjF7a+mgM="
Cancel-Lock: sha1:5vDfyUoldWwsnKlmAipqH8CG3Aw=
X-Newsreader: Forte Agent 3.3/32.846
 by: dave_tho...@comcast.net - Fri, 1 Mar 2024 23:37 UTC

On Sun, 25 Feb 2024 14:54:35 -0800, Keith Thompson
<Keith.S.Thompson+u@gmail.com> wrote:

> porkchop@invalid.foo (Mike Sanders) writes:
> > Keith Thompson <Keith.S.Thompson+u@gmail.com> wrote:
> >> It's recommended *not* to include the current directory in $PATH.
> >
> > I've been thinking about that very thing in fact. It renders my
> > idea of a binary reading a few bytes from its-self all but dead.
> > I wont subvert a given security model for a configuration flag
> > or two...
> >
> > But there you have it, a wonky idea, I've got plenty of them.
>
> Under Linux, a program can find its executable via /proc/$$/exe .

YM sprintf(buf, "/proc/%d/exe", getpid()) // or if paranoid snprintf
because substituting for $$ is a feature of shell and perl only. But
/proc/self/exe works in anything.

Re: getOpsFromSelf() (Long Post)

<urtu9h$1hb36$1@dont-email.me>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=33996&group=comp.lang.c#33996

  copy link   Newsgroups: comp.lang.c
Path: i2pn2.org!i2pn.org!eternal-september.org!feeder3.eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail
From: porkc...@invalid.foo (Mike Sanders)
Newsgroups: comp.lang.c
Subject: Re: getOpsFromSelf() (Long Post)
Date: Sat, 2 Mar 2024 01:10:09 -0000 (UTC)
Organization: A noiseless patient Spider
Lines: 15
Sender: Mike Sanders <busybox@sdf.org>
Message-ID: <urtu9h$1hb36$1@dont-email.me>
References: <ur1ie5$2cgfo$1@dont-email.me> <jh8EdBXIFQu4WLaKt@bongo-ra.co> <1HyZeCKHsTViXCSYj@bongo-ra.co> <urdmt4$1d3vr$3@dont-email.me> <87y1b9wbfs.fsf@nosuchdomain.example.com> <urf9g5$1qtds$1@dont-email.me> <87h6hww3x0.fsf@nosuchdomain.example.com> <jfp4uid7emkscphducofhqdpg8jdbstnun@4ax.com>
Injection-Date: Sat, 2 Mar 2024 01:10:09 -0000 (UTC)
Injection-Info: dont-email.me; posting-host="2c149973da73c4eae3afd661444d5e51";
logging-data="1616998"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX19+aFJ8ijShfNrEcPXhHP+t"
User-Agent: tin/2.6.2-20221225 ("Pittyvaich") (NetBSD/9.3 (amd64))
Cancel-Lock: sha1:fFh8Nb33IM7V16jF3pwRZ24khrU=
 by: Mike Sanders - Sat, 2 Mar 2024 01:10 UTC

dave_thompson_2@comcast.net wrote:

> YM sprintf(buf, "/proc/%d/exe", getpid()) // or if paranoid snprintf
> because substituting for $$ is a feature of shell and perl only. But
> /proc/self/exe works in anything.

For Linux, sure. But the BSDs & Apple & Win...

Reading itsself, its real self, seems to me to be the only
cross platform way.

--
:wq
Mike Sanders

Re: getOpsFromSelf() (Long Post)

<uru3at$1d7qp$2@dont-email.me>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=33998&group=comp.lang.c#33998

  copy link   Newsgroups: comp.lang.c
Path: i2pn2.org!i2pn.org!news.chmurka.net!eternal-september.org!feeder3.eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail
From: lew.pitc...@digitalfreehold.ca (Lew Pitcher)
Newsgroups: comp.lang.c
Subject: Re: getOpsFromSelf() (Long Post)
Date: Sat, 2 Mar 2024 02:36:14 -0000 (UTC)
Organization: A noiseless patient Spider
Lines: 20
Message-ID: <uru3at$1d7qp$2@dont-email.me>
References: <ur1ie5$2cgfo$1@dont-email.me> <jh8EdBXIFQu4WLaKt@bongo-ra.co>
<1HyZeCKHsTViXCSYj@bongo-ra.co> <urdmt4$1d3vr$3@dont-email.me>
<87y1b9wbfs.fsf@nosuchdomain.example.com> <urf9g5$1qtds$1@dont-email.me>
<87h6hww3x0.fsf@nosuchdomain.example.com>
<jfp4uid7emkscphducofhqdpg8jdbstnun@4ax.com>
<urtu9h$1hb36$1@dont-email.me>
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Injection-Date: Sat, 2 Mar 2024 02:36:14 -0000 (UTC)
Injection-Info: dont-email.me; posting-host="83021536b0505deda7fdd938fb72990b";
logging-data="1482585"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX19VAsspk2zktOo7bStnUIYnPOkYs5RvXcM="
User-Agent: Pan/0.139 (Sexual Chocolate; GIT bf56508
git://git.gnome.org/pan2)
Cancel-Lock: sha1:qz4oDdsZDWDskdZNHKfiz979fuA=
 by: Lew Pitcher - Sat, 2 Mar 2024 02:36 UTC

On Sat, 02 Mar 2024 01:10:09 +0000, Mike Sanders wrote:

> dave_thompson_2@comcast.net wrote:
>
>> YM sprintf(buf, "/proc/%d/exe", getpid()) // or if paranoid snprintf
>> because substituting for $$ is a feature of shell and perl only. But
>> /proc/self/exe works in anything.
>
> For Linux, sure. But the BSDs & Apple & Win...
>
> Reading itsself, its real self, seems to me to be the only
> cross platform way.

Perhaps, but there seems to be no cross-platform way for a program
to determine the "itself" to read.

--
Lew Pitcher
"In Skills We Trust"

Re: getOpsFromSelf() (Long Post)

<urv557$1s387$1@dont-email.me>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=34000&group=comp.lang.c#34000

  copy link   Newsgroups: comp.lang.c
Path: i2pn2.org!i2pn.org!eternal-september.org!feeder3.eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail
From: porkc...@invalid.foo (Mike Sanders)
Newsgroups: comp.lang.c
Subject: Re: getOpsFromSelf() (Long Post)
Date: Sat, 2 Mar 2024 12:13:27 -0000 (UTC)
Organization: A noiseless patient Spider
Lines: 18
Sender: Mike Sanders <busybox@sdf.org>
Message-ID: <urv557$1s387$1@dont-email.me>
References: <ur1ie5$2cgfo$1@dont-email.me> <jh8EdBXIFQu4WLaKt@bongo-ra.co> <1HyZeCKHsTViXCSYj@bongo-ra.co> <urdmt4$1d3vr$3@dont-email.me> <87y1b9wbfs.fsf@nosuchdomain.example.com> <urf9g5$1qtds$1@dont-email.me> <87h6hww3x0.fsf@nosuchdomain.example.com> <jfp4uid7emkscphducofhqdpg8jdbstnun@4ax.com> <urtu9h$1hb36$1@dont-email.me> <uru3at$1d7qp$2@dont-email.me>
Injection-Date: Sat, 2 Mar 2024 12:13:27 -0000 (UTC)
Injection-Info: dont-email.me; posting-host="2c149973da73c4eae3afd661444d5e51";
logging-data="1969415"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX18Os8Z2rlfG5u798dCH3M11"
User-Agent: tin/2.6.2-20221225 ("Pittyvaich") (NetBSD/9.3 (amd64))
Cancel-Lock: sha1:TagUL1RHbmW1VinoTgT7bui6BOY=
 by: Mike Sanders - Sat, 2 Mar 2024 12:13 UTC

Lew Pitcher <lew.pitcher@digitalfreehold.ca> wrote:

>> For Linux, sure. But the BSDs & Apple & Win...
>>
>> Reading itsself, its real self, seems to me to be the only
>> cross platform way.
>
> Perhaps, but there seems to be no cross-platform way for a program
> to determine the "itself" to read.

Another thing too Lew... what if there is *no* path (for instance
something like a small controller/embedded environment)? It couldn't
find itsself in any event then I'm thinking.

--
:wq
Mike Sanders

Re: getOpsFromSelf() (Long Post)

<urv5ab$1s387$2@dont-email.me>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=34001&group=comp.lang.c#34001

  copy link   Newsgroups: comp.lang.c
Path: i2pn2.org!i2pn.org!eternal-september.org!feeder3.eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail
From: porkc...@invalid.foo (Mike Sanders)
Newsgroups: comp.lang.c
Subject: Re: getOpsFromSelf() (Long Post)
Date: Sat, 2 Mar 2024 12:16:12 -0000 (UTC)
Organization: A noiseless patient Spider
Lines: 15
Sender: Mike Sanders <busybox@sdf.org>
Message-ID: <urv5ab$1s387$2@dont-email.me>
References: <ur1ie5$2cgfo$1@dont-email.me> <jh8EdBXIFQu4WLaKt@bongo-ra.co> <1HyZeCKHsTViXCSYj@bongo-ra.co> <urdmt4$1d3vr$3@dont-email.me> <4ChoIpqkfcFQsXBXl@bongo-ra.co>
Injection-Date: Sat, 2 Mar 2024 12:16:12 -0000 (UTC)
Injection-Info: dont-email.me; posting-host="2c149973da73c4eae3afd661444d5e51";
logging-data="1969415"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX18mivoJi6s9RnnSBsKUR2Zq"
User-Agent: tin/2.6.2-20221225 ("Pittyvaich") (NetBSD/9.3 (amd64))
Cancel-Lock: sha1:D1CWwsZoN7b7gvfgY9aZfVSJZ+4=
 by: Mike Sanders - Sat, 2 Mar 2024 12:16 UTC

Spiros Bousbouras <spibou@gmail.com> wrote:

> Which may be the wrong order. Regardless of the overall merits of your idea ,
> it should mimic as close as possible how the system finds executables. This
> means not search in the current directory unless the appropriate constructs
> exist in PATH and search the components in the same order as they appear in
> PATH .This implies recognising :: in PATH and my point is that using
> strtok() (apart from its other issues) makes it harder to do this.

Yes, sounds like good advice to me Spiros.

--
:wq
Mike Sanders

Pages:12
server_pubkey.txt

rocksolid light 0.9.8
clearnet tor