Rocksolid Light

Welcome to RetroBBS

mail  files  register  newsreader  groups  login

Message-ID:  

Saint: A dead sinner revised and edited. -- Ambrose Bierce


devel / comp.infosystems.gemini / Gemini sessions and CSRF

SubjectAuthor
* Gemini sessions and CSRFCyrus Valkonen
`- Re: Gemini sessions and CSRFmbays

1
Gemini sessions and CSRF

<tdognu$8pu$1@gioia.aioe.org>

  copy mid

https://www.rocksolidbbs.com/devel/article-flat.php?id=292&group=comp.infosystems.gemini#292

  copy link   Newsgroups: comp.infosystems.gemini
Path: i2pn2.org!i2pn.org!aioe.org!zPIEzWKt9aq44BHOs3QwnQ.user.46.165.242.75.POSTED!not-for-mail
From: cyrus.valkonen@gmail.com (Cyrus Valkonen)
Newsgroups: comp.infosystems.gemini
Subject: Gemini sessions and CSRF
Date: Fri, 19 Aug 2022 19:19:58 +0200
Organization: Aioe.org NNTP Server
Message-ID: <tdognu$8pu$1@gioia.aioe.org>
Mime-Version: 1.0
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 7bit
Injection-Info: gioia.aioe.org; logging-data="9022"; posting-host="zPIEzWKt9aq44BHOs3QwnQ.user.gioia.aioe.org"; mail-complaints-to="abuse@aioe.org";
User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101
Thunderbird/91.10.0
Content-Language: en-US
X-Notice: Filtered by postfilter v. 0.9.2
 by: Cyrus Valkonen - Fri, 19 Aug 2022 17:19 UTC

Sessions are necessary in Gemini for: multi variable input, user
creation, login and interaction, captchas and other anti-bot features
required to accept meaningful input from visitors, and other crucial
features of a website.

There are two viable ways to create client sessions in Gemini:

1. By requesting a client certificate and using the TLS hash of it.
2. By storing the session id in the URL directly.

If you have never heard about #1: Gemini has a special feature that
prompts the user in the browser to send or create a personal identifier
(either temporary or permanent). The user just has to press one or two
buttons to proceed. It is basically identical to creating a cookie. You
can then identify that user from your CGI script via the TLS hash
variable and store/retrieve session data from some database.

If you have never though of #2: Using redirect rules of your Gemini
server, you can also create sessions this way:

http://example.com/session-JBOQtGmWhED6L6Dfp7l1Hf/application

This URL is offered like any other and it does not require the user to
click through any dialogues.

CSRF is a very primitive kind of attack. For example on the page
gemini://eviljoe.net/ the website owner can trick you to open a link on
an external page that invokes an action, for example:

gemini://astrobotany.mozz.us/app/killplant

If you had an authenticated account there, this would kill your
Tamagotchi on that site. This is why CSRF tokens are used in HTTP
applications. If the Astrobotany app required the TLS hash to be present
in the URL, ideally encoded in base62, like so:

gemini://astrobotany.mozz.us/app/killplant#JBOQtGmWhED6L6Dfp7l1Hf

Then it would be impossible for an attacker to invoke that action.

CSRF attacks only become really powerful if links are loaded in the
background. And exactly this will happen with Gemini in the future, when
browsers might develop more crawler-alike features that are in line with
the protocol specifications. The first thing that will happen is image
URLs being shown as images directly (already present in some ebook
readers). One step further, all media data, maybe CSV tables, possibly
mini-previews of all URLs if hovered like on Wikipedia. Without changing
the nature of Gemini, clients will seek to enrich the experience as much
as reasonable and possible.

It is obvious then that using client certificates present a security
risk that needs to be addressed today. And that temporary certificates
only yield disadvantages compared to storing a session-token directly in
the URL as shown in #2. It stands to reason then how useful client
certificates in Gemini really are for permanent authentication, compared
to user passwords, and if one might not want to avoid them all together.

Best regards,

Cyrus

Re: Gemini sessions and CSRF

<slrntgjj1v.4p4.mbays@ma.sdf.org>

  copy mid

https://www.rocksolidbbs.com/devel/article-flat.php?id=293&group=comp.infosystems.gemini#293

  copy link   Newsgroups: comp.infosystems.gemini
Path: i2pn2.org!i2pn.org!aioe.org!news.uzoreto.com!feeder1.feed.usenet.farm!feed.usenet.farm!peer03.ams4!peer.am4.highwinds-media.com!peer01.iad!feed-me.highwinds-media.com!news.highwinds-media.com!fx17.iad.POSTED!not-for-mail
Newsgroups: comp.infosystems.gemini
From: mbays@sdf.org
Subject: Re: Gemini sessions and CSRF
References: <tdognu$8pu$1@gioia.aioe.org>
User-Agent: slrn/1.0.3 (Linux)
Message-ID: <slrntgjj1v.4p4.mbays@ma.sdf.org>
Lines: 19
X-Complaints-To: abuse(at)newshosting.com
NNTP-Posting-Date: Sat, 27 Aug 2022 07:48:15 UTC
Organization: Newshosting.com - Highest quality at a great price! www.newshosting.com
Date: Sat, 27 Aug 2022 07:48:15 GMT
X-Received-Bytes: 1686
 by: mbays@sdf.org - Sat, 27 Aug 2022 07:48 UTC

In comp.infosystems.gemini, you wrote:
> CSRF is a very primitive kind of attack. For example on the page
> gemini://eviljoe.net/ the website owner can trick you to open a link on
> an external page that invokes an action [...]
> It is obvious then that using client certificates present a security
> risk that needs to be addressed today.

This was discussed before, and the conclusion at least some of us
reached is that it should be addressed in clients by preventing any
certificate from being applied to requests generated by such
"cross-site" links (unless the user explicitly says it should).

We have a neat way to determine what should count as a "cross-site"
link: as explained in the gemini spec, each client certificate in use is
associated with a "scope", a subtree of URLs where it will be used. So
a certificate which is in use at URL1 should also be used in a request
to URL2 generated by following a link from URL1 if and only if URL2 is
in the scope of that certificate. In all other cases, no certificate
should be used at URL2 without explicit user consent.

1
server_pubkey.txt

rocksolid light 0.9.81
clearnet tor