Skip to content

Commit

Permalink
sslgetcert: Add EC Point Formats extension to TLS handshake (fix conn…
Browse files Browse the repository at this point in the history
…ections to Vercel servers)

As described in Section 5.1.2 of RFC 8422, the EC Point Formats
extension is valid for TLS 1.2 and earlier.  It is deprecated in TLS
1.3 (RFC 8446), but that doesn't stop some servers from requiring it.
There is no harm in supplying the extension to a TLS 1.3 server.

In particular, Vercel (https://vercel.com/) TLS terminators seem to
respond with a handshake failure alert if the EC Point Format
extension is not present in the Client Hello.

This can be seen with measurement 49131334:
https://atlas.ripe.net/measurements/49131334/#probes

This changeset should add the EC Point Format extension to the probe,
which will result in successful certificate harvesting from Vercel
servers, without introducing any incompatibilities to other servers.
  • Loading branch information
dkg committed Jan 25, 2023
1 parent 4ffcc7f commit aa65cf6
Showing 1 changed file with 29 additions and 1 deletion.
30 changes: 29 additions & 1 deletion eperd/sslgetcert.c
Original file line number Diff line number Diff line change
Expand Up @@ -611,6 +611,25 @@ static void add_compression(struct hsbuf *hsbuf)
hsbuf_add(hsbuf, compression, len);
}

static void ext_ec_point_formats(struct hsbuf *hsbuf)
{
uint16_t epfextlen;
uint8_t epflen;
size_t len;
uint8_t point_formats[]= { 0x0 /* uncompressed */ };

len= sizeof(point_formats);

epflen= len;
epfextlen = len + 1;
hsbuf_add(hsbuf, &c, 1);

hsbuf_add_u16(hsbuf, 11 /*ec_point_formats*/);
hsbuf_add_u16(hsbuf, epfextlen);
hsbuf_add(hsbuf, &epflen, sizeof(epflen));
hsbuf_add(hsbuf, point_formats, len);
}

static void ext_sigs(struct hsbuf *hsbuf)
{
uint16_t sigextlen, siglen;
Expand Down Expand Up @@ -687,13 +706,18 @@ static void add_extensions(struct state *state, struct hsbuf *hsbuf)
size_t size_extensions;
struct hsbuf ext_sigs_buf;
struct hsbuf sni_buf;
struct hsbuf ec_point_formats_buf;
struct hsbuf elliptic_curves_buf;

/* SNI */
hsbuf_init(&sni_buf);
if (state->sni)
sni(&sni_buf, state->sni);

/* EC point formats */
hsbuf_init(&ec_point_formats_buf);
ext_ec_point_formats(&ec_point_formats_buf);

/* Signatures */
hsbuf_init(&ext_sigs_buf);
ext_sigs(&ext_sigs_buf);
Expand All @@ -702,12 +726,16 @@ static void add_extensions(struct state *state, struct hsbuf *hsbuf)
hsbuf_init(&elliptic_curves_buf);
elliptic_curves(&elliptic_curves_buf);

size_extensions= hsbuf_len(&sni_buf) + hsbuf_len(&ext_sigs_buf) +
size_extensions= hsbuf_len(&sni_buf) +
hsbuf_len(&ext_ec_point_formats_buf) +
hsbuf_len(&ext_sigs_buf) +
hsbuf_len(&elliptic_curves_buf);

hsbuf_add_u16(hsbuf, size_extensions);
hsbuf_copy(hsbuf, &sni_buf);
hsbuf_cleanup(&sni_buf);
hsbuf_copy(hsbuf, &ec_point_formats_buf);
hsbuf_cleanup(&ec_point_formats_buf);
hsbuf_copy(hsbuf, &ext_sigs_buf);
hsbuf_cleanup(&ext_sigs_buf);
hsbuf_copy(hsbuf, &elliptic_curves_buf);
Expand Down

0 comments on commit aa65cf6

Please sign in to comment.