linux-ppp.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Paul Mackerras <paulus@ozlabs.org>
To: linux-ppp@vger.kernel.org
Subject: Re: [PATCH v3] pppoe: custom host-uniq tag
Date: Sat, 10 Nov 2018 06:55:24 +0000	[thread overview]
Message-ID: <20181110065524.GA17160@blackberry> (raw)
In-Reply-To: <20181107235243.676-1-mcroce@redhat.com>

On Thu, Nov 08, 2018 at 12:52:43AM +0100, Matteo Croce wrote:
> Add pppoe 'host-uniq' option to set an arbitrary
> host-uniq tag instead of the pppd pid.
> Some ISPs use such tag to authenticate the CPE,
> so it must be set to a proper value to connect.

In the absence of a man page for rp-pppoe, I'd like to see a
description of the new option and the syntax for its argument in the
patch description.

And unfortunately, I think there is a user-triggerable buffer overrun
that you've added:

> +static inline int parseHostUniq(const char *uniq, PPPoETag *tag)
> +{
> +    unsigned i, len = strlen(uniq);
> +
> +#define hex(x) \
> +    (((x) <= '9') ? ((x) - '0') : \
> +        (((x) <= 'F') ? ((x) - 'A' + 10) : \
> +            ((x) - 'a' + 10)))
> +
> +    if (!len || len & 1)
> +        return 0;
> +
> +    for (i = 0; i < len; i += 2)
> +    {
> +        if (!isxdigit(uniq[i]) || !isxdigit(uniq[i+1]))
> +            return 0;
> +
> +        tag->payload[i / 2] = (char)(hex(uniq[i]) << 4 | hex(uniq[i+1]));
> +    }
> +
> +#undef hex
> +
> +    tag->type = htons(TAG_HOST_UNIQ);
> +    tag->length = htons(len / 2);
> +    return 1;
> +}
> +

If I give a sufficiently long argument to the host-uniq option, I can
overflow conn->hostUniq and write whatever I want into whatever
follows it in the heap, can't I?

Paul.

  reply	other threads:[~2018-11-10  6:55 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-11-07 23:52 [PATCH v3] pppoe: custom host-uniq tag Matteo Croce
2018-11-10  6:55 ` Paul Mackerras [this message]
2018-11-23 18:34 ` Matteo Croce

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20181110065524.GA17160@blackberry \
    --to=paulus@ozlabs.org \
    --cc=linux-ppp@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).