Rocksolid Light

Welcome to RetroBBS

mail  files  register  newsreader  groups  login

Message-ID:  

All your files have been destroyed (sorry). Paul.


computers / alt.os.linux.mageia / Re: Warning: Openconnect my overwrite your data

SubjectAuthor
* Warning: Openconnect my overwrite your dataMarkus Robert Kessler
+- Re: Warning: Openconnect my overwrite your datared floyd
+- Re: Warning: Openconnect my overwrite your dataMarkus Robert Kessler
+- Conclusio: Warning: Openconnect my overwrite your dataMarkus Robert Kessler
`- Re: Warning: Openconnect my overwrite your dataMarkus Robert Kessler

1
Warning: Openconnect my overwrite your data

<uf213u$38o1c$1@dont-email.me>

  copy mid

https://www.rocksolidbbs.com/computers/article-flat.php?id=5804&group=alt.os.linux.mageia#5804

  copy link   Newsgroups: alt.os.linux.mageia
Path: i2pn2.org!i2pn.org!eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail
From: no_reply@dipl-ing-kessler.de (Markus Robert Kessler)
Newsgroups: alt.os.linux.mageia
Subject: Warning: Openconnect my overwrite your data
Date: Wed, 27 Sep 2023 19:51:26 -0000 (UTC)
Organization: A noiseless patient Spider
Lines: 34
Message-ID: <uf213u$38o1c$1@dont-email.me>
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Injection-Date: Wed, 27 Sep 2023 19:51:26 -0000 (UTC)
Injection-Info: dont-email.me; posting-host="b0f8bd88a51f984f8c99e53e8eacadb2";
logging-data="3432492"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX193z/W/qa46UNMPcFFzLkGl"
User-Agent: Pan/0.149 (Bellevue; 4c157ba git@gitlab.gnome.org:GNOME/pan.git)
Cancel-Lock: sha1:NFWliYkKsDw89V2TFl39LGVQ3fw=
 by: Markus Robert Kessle - Wed, 27 Sep 2023 19:51 UTC

For years I am setting up sudo-based cisco vpnc vpn access, so that
"normal" users can open / close vpns without root password.

Now I did the same with openconnect.
This one also provides the option "--pid-file", which is handy, because
vpnc provides a small program called "vpnc-disconnect", which looks for
the pid hardcoded in /run/vpnc.pid. So, I set up openconnect to use the
same pid-file, and hence oepnconnect can be also terminated using "vpnc-
disconnect".

Well, this option looked suspicious to me from the beginning, and so I had
a look into the sources. There I saw something like "prefix" and other
fancy things around the pid-file, and so I thought this was to "sanitize"
user input.

But it was not.

I tried "openconnect --pid-file /dev/sda ..."

and, guess? -- Yes, the box did not boot anymore.

What makes me nervous is that every non-privileged user can do the same.
Vpnc seems to have the same security hole.

I am just thinking about recompile and rebuild the packages, where this
option is excluded and the pid file is hardcoded to, let's say /run/
vpnc.pid.

Any idea?

Markus
--
Please reply to group only.
For private email please use http://www.dipl-ing-kessler.de/email.htm

Re: Warning: Openconnect my overwrite your data

<uf2gk0$3bhje$1@redfloyd.dont-email.me>

  copy mid

https://www.rocksolidbbs.com/computers/article-flat.php?id=5805&group=alt.os.linux.mageia#5805

  copy link   Newsgroups: alt.os.linux.mageia
Path: i2pn2.org!i2pn.org!eternal-september.org!news.eternal-september.org!redfloyd.dont-email.me!.POSTED!not-for-mail
From: no.spam.here@its.invalid (red floyd)
Newsgroups: alt.os.linux.mageia
Subject: Re: Warning: Openconnect my overwrite your data
Date: Wed, 27 Sep 2023 17:15:59 -0700
Organization: A noiseless patient Spider
Lines: 33
Message-ID: <uf2gk0$3bhje$1@redfloyd.dont-email.me>
References: <uf213u$38o1c$1@dont-email.me>
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 7bit
Injection-Date: Thu, 28 Sep 2023 00:16:00 -0000 (UTC)
Injection-Info: redfloyd.dont-email.me; posting-host="e677135209ac376c936a3be45e555949";
logging-data="3524206"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1/8n1eUKFtbl/ou76Oj7kYE5yl4h6H/gvg="
User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:102.0) Gecko/20100101
Thunderbird/102.15.1
Cancel-Lock: sha1:f7W/vLx1r5u/qZHAzY9TSHJmnt4=
Content-Language: en-US
In-Reply-To: <uf213u$38o1c$1@dont-email.me>
 by: red floyd - Thu, 28 Sep 2023 00:15 UTC

On 9/27/2023 12:51 PM, Markus Robert Kessler wrote:
> For years I am setting up sudo-based cisco vpnc vpn access, so that
> "normal" users can open / close vpns without root password.
>
> Now I did the same with openconnect.
> This one also provides the option "--pid-file", which is handy, because
> vpnc provides a small program called "vpnc-disconnect", which looks for
> the pid hardcoded in /run/vpnc.pid. So, I set up openconnect to use the
> same pid-file, and hence oepnconnect can be also terminated using "vpnc-
> disconnect".
>
> Well, this option looked suspicious to me from the beginning, and so I had
> a look into the sources. There I saw something like "prefix" and other
> fancy things around the pid-file, and so I thought this was to "sanitize"
> user input.
>
> But it was not.
>
> I tried "openconnect --pid-file /dev/sda ..."
>
> and, guess? -- Yes, the box did not boot anymore.
>
> What makes me nervous is that every non-privileged user can do the same.
> Vpnc seems to have the same security hole.
>
> I am just thinking about recompile and rebuild the packages, where this
> option is excluded and the pid file is hardcoded to, let's say /run/
> vpnc.pid.
>

What the heck did you think would happen when you told it to write over
your hard drive boot sector?

Re: Warning: Openconnect my overwrite your data

<uf3sva$3mcu9$1@dont-email.me>

  copy mid

https://www.rocksolidbbs.com/computers/article-flat.php?id=5808&group=alt.os.linux.mageia#5808

  copy link   Newsgroups: alt.os.linux.mageia
Path: i2pn2.org!i2pn.org!eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail
From: no_reply@dipl-ing-kessler.de (Markus Robert Kessler)
Newsgroups: alt.os.linux.mageia
Subject: Re: Warning: Openconnect my overwrite your data
Date: Thu, 28 Sep 2023 12:52:59 -0000 (UTC)
Organization: A noiseless patient Spider
Lines: 83
Message-ID: <uf3sva$3mcu9$1@dont-email.me>
References: <uf213u$38o1c$1@dont-email.me>
<op.2bygi20va3w0dxdave@hodgins.homeip.net>
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Injection-Date: Thu, 28 Sep 2023 12:52:59 -0000 (UTC)
Injection-Info: dont-email.me; posting-host="dd838107b1171c915e82b2b66025c065";
logging-data="3879881"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX18q3Qtf9fwVhklVPw9x3qv2"
User-Agent: Pan/0.145 (Duplicitous mercenary valetism; d7e168a
git.gnome.org/pan2)
Cancel-Lock: sha1:WdvafNHS01yL8bhkQYhdontWYpA=
 by: Markus Robert Kessle - Thu, 28 Sep 2023 12:52 UTC

On Wed, 27 Sep 2023 20:19:40 -0400 David W. Hodgins wrote:

> On Wed, 27 Sep 2023 15:51:26 -0400, Markus Robert Kessler
> <no_reply@dipl-ing-kessler.de> wrote:
>
>> For years I am setting up sudo-based cisco vpnc vpn access, so that
>> "normal" users can open / close vpns without root password.
>>
>> Now I did the same with openconnect.
>> This one also provides the option "--pid-file", which is handy, because
>> vpnc provides a small program called "vpnc-disconnect", which looks for
>> the pid hardcoded in /run/vpnc.pid. So, I set up openconnect to use the
>> same pid-file, and hence oepnconnect can be also terminated using
>> "vpnc- disconnect".
>>
>> Well, this option looked suspicious to me from the beginning, and so I
>> had a look into the sources. There I saw something like "prefix" and
>> other fancy things around the pid-file, and so I thought this was to
>> "sanitize" user input.
>>
>> But it was not.
>>
>> I tried "openconnect --pid-file /dev/sda ..."
>>
>> and, guess? -- Yes, the box did not boot anymore.
>>
>> What makes me nervous is that every non-privileged user can do the
>> same. Vpnc seems to have the same security hole.
>>
>> I am just thinking about recompile and rebuild the packages, where this
>> option is excluded and the pid file is hardcoded to, let's say /run/
>> vpnc.pid.
>>
>> Any idea?
>
> The openconnect binary is in /usr/sbin instead of /usr/bin because it's
> intended to be restricted to people who can be trusted.
>
> If I were trying to set it up so that untrusted regular users could
> still start and stop it, look at something like mgaonline for how it
> does it's stuff.
> /usr/bin/mgaupdate uses pkexec to run /usr/libexec/mgaupdate with root
> privileges.
>
> Assuming there are a limited number of vpn accounts that are to be used,
> set up openconnect to use scripts in /usr/local/sbin that does what's
> needed, and create scripts in /usr/local/bin that uses pkexec to run the
> sbin scripts.
>
> Don't allow any input from the user to be passed directly to the
> openconnect command. If any user input is passed, it would require very
> good filtering to prevent them passing something like
> "configfilename='../../../dev/sda'"
> or "configfilename='thefilename;rm -rf /'" instead of just a filename.
>
> Regards, Dave Hodgins

Hi,

first I'd like to mention that I took a box which was not really needed,
and, in I repaired it easily and fast by rewriting the MBR via rescue
boot from installation DVD. So, no real damage occurred.

But the reason for mentioning this here is that one always can make
mistakes when passing options to programs.

The original authors of openconnect and vpnc should consider limiting
path and file to /run/vpn.pid or so, and filter away any attempt to write
to other locations ( '/', '..' ).

Due to the dangerous bugs pkexec showed up in the past makes me think of
some alternative ways.

Anyway, thanks!

Best regards,

Markus

--
Please reply to group only.
For private email please use http://www.dipl-ing-kessler.de/email.htm

Conclusio: Warning: Openconnect my overwrite your data

<uf403a$3n0dj$1@dont-email.me>

  copy mid

https://www.rocksolidbbs.com/computers/article-flat.php?id=5809&group=alt.os.linux.mageia#5809

  copy link   Newsgroups: alt.os.linux.mageia
Path: i2pn2.org!i2pn.org!eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail
From: no_reply@dipl-ing-kessler.de (Markus Robert Kessler)
Newsgroups: alt.os.linux.mageia
Subject: Conclusio: Warning: Openconnect my overwrite your data
Date: Thu, 28 Sep 2023 13:46:18 -0000 (UTC)
Organization: A noiseless patient Spider
Lines: 58
Message-ID: <uf403a$3n0dj$1@dont-email.me>
References: <uf213u$38o1c$1@dont-email.me>
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Injection-Date: Thu, 28 Sep 2023 13:46:18 -0000 (UTC)
Injection-Info: dont-email.me; posting-host="dd838107b1171c915e82b2b66025c065";
logging-data="3899827"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1/hLm4hCMxLdf6IeFQOybJp"
User-Agent: Pan/0.145 (Duplicitous mercenary valetism; d7e168a
git.gnome.org/pan2)
Cancel-Lock: sha1:qCDWDK419wIVQz7MPII7SorM5tk=
 by: Markus Robert Kessle - Thu, 28 Sep 2023 13:46 UTC

On Wed, 27 Sep 2023 19:51:26 +0000 Markus Robert Kessler wrote:

> For years I am setting up sudo-based cisco vpnc vpn access, so that
> "normal" users can open / close vpns without root password.
>
> Now I did the same with openconnect.
> This one also provides the option "--pid-file", which is handy, because
> vpnc provides a small program called "vpnc-disconnect", which looks for
> the pid hardcoded in /run/vpnc.pid. So, I set up openconnect to use the
> same pid-file, and hence oepnconnect can be also terminated using "vpnc-
> disconnect".
>
> Well, this option looked suspicious to me from the beginning, and so I
> had a look into the sources. There I saw something like "prefix" and
> other fancy things around the pid-file, and so I thought this was to
> "sanitize" user input.
>
> But it was not.
>
> I tried "openconnect --pid-file /dev/sda ..."
>
> and, guess? -- Yes, the box did not boot anymore.
>
> What makes me nervous is that every non-privileged user can do the same.
> Vpnc seems to have the same security hole.
>
> I am just thinking about recompile and rebuild the packages, where this
> option is excluded and the pid file is hardcoded to, let's say /run/
> vpnc.pid.
>
> Any idea?
>
> Markus

After comparing to Raspbian OS I found out the following:

Raspbian OS / Debian allows to write to any location and any filename, as
long as either non-existing, or ending on '.pid'.

So, for instance it is not possible to write to /etc/passwd,
but it is possible to write to /run/openconnect.foo as long as it is not
there yet, and it is possible to overwrite /run/vpnc.pid if the former
openconnect process was 'pkill -9'-ed hence the file still exists.

Conclusio:

The source seems the same for the distros out there, but Debian has some
patches, preventing people from smashing their boxes by intention or by
accident.

Mageie (9 and most probably older ones) do not have such security means.

Markus

--
Please reply to group only.
For private email please use http://www.dipl-ing-kessler.de/email.htm

Re: Warning: Openconnect my overwrite your data

<ufv38p$39vfb$1@dont-email.me>

  copy mid

https://www.rocksolidbbs.com/computers/article-flat.php?id=5829&group=alt.os.linux.mageia#5829

  copy link   Newsgroups: alt.os.linux.mageia
Path: i2pn2.org!i2pn.org!eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail
From: no_reply@dipl-ing-kessler.de (Markus Robert Kessler)
Newsgroups: alt.os.linux.mageia
Subject: Re: Warning: Openconnect my overwrite your data
Date: Sun, 8 Oct 2023 20:26:01 -0000 (UTC)
Organization: A noiseless patient Spider
Lines: 94
Message-ID: <ufv38p$39vfb$1@dont-email.me>
References: <uf213u$38o1c$1@dont-email.me>
<op.2bygi20va3w0dxdave@hodgins.homeip.net>
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Injection-Date: Sun, 8 Oct 2023 20:26:01 -0000 (UTC)
Injection-Info: dont-email.me; posting-host="c724b96d32c25038868db6c5c0ea1be8";
logging-data="3472875"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1/k6hCMQTfPlUMHfgDlumAj"
User-Agent: Pan/0.149 (Bellevue; 4c157ba git@gitlab.gnome.org:GNOME/pan.git)
Cancel-Lock: sha1:PG+pN//Gvk0hQd9h5n8QRr79xdA=
 by: Markus Robert Kessle - Sun, 8 Oct 2023 20:26 UTC

On Wed, 27 Sep 2023 20:19:40 -0400 David W. Hodgins wrote:

> On Wed, 27 Sep 2023 15:51:26 -0400, Markus Robert Kessler
> <no_reply@dipl-ing-kessler.de> wrote:
>
>> For years I am setting up sudo-based cisco vpnc vpn access, so that
>> "normal" users can open / close vpns without root password.
>>
>> Now I did the same with openconnect.
>> This one also provides the option "--pid-file", which is handy, because
>> vpnc provides a small program called "vpnc-disconnect", which looks for
>> the pid hardcoded in /run/vpnc.pid. So, I set up openconnect to use the
>> same pid-file, and hence oepnconnect can be also terminated using
>> "vpnc- disconnect".
>>
>> Well, this option looked suspicious to me from the beginning, and so I
>> had a look into the sources. There I saw something like "prefix" and
>> other fancy things around the pid-file, and so I thought this was to
>> "sanitize" user input.
>>
>> But it was not.
>>
>> I tried "openconnect --pid-file /dev/sda ..."
>>
>> and, guess? -- Yes, the box did not boot anymore.
>>
>> What makes me nervous is that every non-privileged user can do the
>> same. Vpnc seems to have the same security hole.
>>
>> I am just thinking about recompile and rebuild the packages, where this
>> option is excluded and the pid file is hardcoded to, let's say /run/
>> vpnc.pid.
>>
>> Any idea?
>
> The openconnect binary is in /usr/sbin instead of /usr/bin because it's
> intended to be restricted to people who can be trusted.
>
> If I were trying to set it up so that untrusted regular users could
> still start and stop it, look at something like mgaonline for how it
> does it's stuff.
> /usr/bin/mgaupdate uses pkexec to run /usr/libexec/mgaupdate with root
> privileges.
>
> Assuming there are a limited number of vpn accounts that are to be used,
> set up openconnect to use scripts in /usr/local/sbin that does what's
> needed, and create scripts in /usr/local/bin that uses pkexec to run the
> sbin scripts.
>
> Don't allow any input from the user to be passed directly to the
> openconnect command. If any user input is passed, it would require very
> good filtering to prevent them passing something like
> "configfilename='../../../dev/sda'"
> or "configfilename='thefilename;rm -rf /'" instead of just a filename.

Hi Dave,

meanwhile I found one more way to do this, without polkit:

The complete commandline to invoke openconnect along with all parameters
is being placed in a c file, for instance

#include <stdio.h>
#include <sys/types.h>
#include <unistd.h>
#include <stdlib.h>

char *SHELL = "openconnect -b --pid-file /var/run/vpnc.pid -u USER [and so
on] SERVER";

void main ( void ) {
setreuid ( geteuid () , getuid () );
system ( SHELL );
}

This has to be compiled like
gcc openconnect-wrapper.c -o openconnect-wrapper

set to root:root 0700 and moved to, let's say /usr/sbin.
So, from the wrapper running sudoed root, the child process openconnect is
inheriting root rights also.

Users who should be able to start/stop the vpn simply get sudo right to
above file.

So, I even don't need to patch every newly published update to this rpm.

Best regards,

Markus

--
Please reply to group only.
For private email please use http://www.dipl-ing-kessler.de/email.htm

1
server_pubkey.txt

rocksolid light 0.9.81
clearnet tor