• Re: More PHP vulnerabilities

    From Simon Clubley@clubley@remove_me.eisner.decus.org-Earth.UFP to comp.os.vms on Mon Nov 23 19:42:50 2026
    From Newsgroup: comp.os.vms

    On 2026-11-20, Arne Vajhűj <arne@vajhoej.dk> wrote:
    On 11/20/2026 3:10 PM, Simon Clubley wrote:
    On 2026-11-20, Arne Vajhűj <arne@vajhoej.dk> wrote:
    On 11/19/2026 4:25 PM, Arne Vajhűj wrote:
    echo file_get_contents("http://arnepc5.vajhoej.dk/reveal.aspx") . "\n"; >>>> //echo file_get_contents("https://arnepc5.vajhoej.dk/reveal.aspx") . "\n"; >>>> echo file_get_contents("https://arnepc5.vajhoej.dk/reveal.aspx", false, >>>> stream_context_create($sslctxopts)) . "\n";
    echo file_get_contents("HTTPS://arnepc5.vajhoej.dk/reveal.aspx") . "\n"; >>>> echo file_get_contents("httpS://arnepc5.vajhoej.dk/reveal.aspx") . "\n"; >>>
    $ php another.php
    Port = 80
    Port = 443
    Port = 80
    Port = 80
    And for the curious - before fix:

    use_ssl = resource->scheme && (ZSTR_LEN(resource->scheme) > 4) &&
    ZSTR_VAL(resource->scheme)[4] == 's';

    I really hope that line was always compiled by a short-circuiting
    compiler and that line always successfully triggered short-circuiting...

    Don't be surprised if everyone is now looking for similar constructs
    that rely on short-circuiting to be safe.
    Doesn't C require/mandate short circuiting in cases like this??


    As Dan has pointed out, yes. However, I absolutely hate that style of
    coding (and the use of short circuiting in general) - it is way too fragile.

    It depends on the compiler behaving as expected and it depends on someone
    not making some edit change that happens to have the unexpected side-effect
    of disabling any working short circuiting.

    Seriously. Please consider not using short circuiting and instead writing
    your code so it works regardless of whether your compiler short-circuits
    or not. (Or it suddenly decides to stop short-circuiting one day).

    Oh, and before you all start mocking me, please read this:

    https://www.redhat.com/en/blog/security-flaws-caused-compiler-optimizations

    Even Linux has been caught out in the past by compilers not behaving
    as expected.

    Simon.
    --
    Simon Clubley, clubley@remove_me.eisner.decus.org-Earth.UFP
    Walking destinations on a map are further away than they appear.
    --- Synchronet 3.21e-Linux NewsLink 1.2
  • From scott@scott@slp53.sl.home (Scott Lurndal) to comp.os.vms on Mon Nov 23 20:18:17 2026
    From Newsgroup: comp.os.vms

    Simon Clubley <clubley@remove_me.eisner.decus.org-Earth.UFP> writes:
    On 2026-11-20, Arne Vajhűj <arne@vajhoej.dk> wrote:
    On 11/20/2026 3:10 PM, Simon Clubley wrote:
    On 2026-11-20, Arne Vajhűj <arne@vajhoej.dk> wrote:
    On 11/19/2026 4:25 PM, Arne Vajhűj wrote:
    echo file_get_contents("http://arnepc5.vajhoej.dk/reveal.aspx") . "\n"; >>>>> //echo file_get_contents("https://arnepc5.vajhoej.dk/reveal.aspx") . "\n";
    echo file_get_contents("https://arnepc5.vajhoej.dk/reveal.aspx", false, >>>>> stream_context_create($sslctxopts)) . "\n";
    echo file_get_contents("HTTPS://arnepc5.vajhoej.dk/reveal.aspx") . "\n"; >>>>> echo file_get_contents("httpS://arnepc5.vajhoej.dk/reveal.aspx") . "\n"; >>>>
    $ php another.php
    Port = 80
    Port = 443
    Port = 80
    Port = 80
    And for the curious - before fix:

    use_ssl = resource->scheme && (ZSTR_LEN(resource->scheme) > 4) &&
    ZSTR_VAL(resource->scheme)[4] == 's';

    I really hope that line was always compiled by a short-circuiting
    compiler and that line always successfully triggered short-circuiting... >>>
    Don't be surprised if everyone is now looking for similar constructs
    that rely on short-circuiting to be safe.
    Doesn't C require/mandate short circuiting in cases like this??


    As Dan has pointed out, yes. However, I absolutely hate that style of
    coding (and the use of short circuiting in general) - it is way too fragile.

    Must disagree. Consider the classic (ptr && *ptr) paradigm.


    It depends on the compiler behaving as expected

    No, it depends on the programmer being familiar with
    the C (and C++) language grammar.

    The chance that any C compiler (outside of a first year college
    course) would not properly handle those operators correctly
    is exactly zero.


    Seriously. Please consider not using short circuiting and instead writing >your code so it works regardless of whether your compiler short-circuits
    or not. (Or it suddenly decides to stop short-circuiting one day).

    Seriously, use the conditonal logical operators frequently and
    often. They'll work correctly unto the heat death of the universe.


    Oh, and before you all start mocking me, please read this:

    https://www.redhat.com/en/blog/security-flaws-caused-compiler-optimizations

    That has nothing to do with the conditional-and/or operators.

    --- Synchronet 3.21e-Linux NewsLink 1.2
  • From Simon Clubley@clubley@remove_me.eisner.decus.org-Earth.UFP to comp.os.vms on Mon Nov 23 20:58:32 2026
    From Newsgroup: comp.os.vms

    On 2026-11-23, Scott Lurndal <scott@slp53.sl.home> wrote:
    Simon Clubley <clubley@remove_me.eisner.decus.org-Earth.UFP> writes:


    As Dan has pointed out, yes. However, I absolutely hate that style of >>coding (and the use of short circuiting in general) - it is way too fragile.

    Must disagree. Consider the classic (ptr && *ptr) paradigm.


    It depends on the compiler behaving as expected

    No, it depends on the programmer being familiar with
    the C (and C++) language grammar.


    Or the programmer is familiar with it but doesn't like it in the same
    way that he doesn't like in-band null string terminators or (in C++)
    he doesn't like the decision for default speed over safety ([] is unchecked instead of checked and you have to use at() for safe access).

    All those are examples of my mindset here BTW. In that latter case, you
    should have got safety by default and if you wanted speed you should have
    had to ask for it.

    The chance that any C compiler (outside of a first year college
    course) would not properly handle those operators correctly
    is exactly zero.


    As in my original posting, the problem could also be introduced at
    application level during an edit.


    Seriously. Please consider not using short circuiting and instead writing >>your code so it works regardless of whether your compiler short-circuits
    or not. (Or it suddenly decides to stop short-circuiting one day).

    Seriously, use the conditonal logical operators frequently and
    often. They'll work correctly unto the heat death of the universe.


    Oh, and before you all start mocking me, please read this:
    https://www.redhat.com/en/blog/security-flaws-caused-compiler-optimizations

    That has nothing to do with the conditional-and/or operators.


    It does if you understand the point I am trying to make.

    Simon.
    --
    Simon Clubley, clubley@remove_me.eisner.decus.org-Earth.UFP
    Walking destinations on a map are further away than they appear.
    --- Synchronet 3.21e-Linux NewsLink 1.2
  • From =?UTF-8?Q?Arne_Vajh=C3=B8j?=@arne@vajhoej.dk to comp.os.vms on Mon Nov 23 16:38:33 2026
    From Newsgroup: comp.os.vms

    On 11/23/2026 2:42 PM, Simon Clubley wrote:
    On 2026-11-20, Arne VajhĂžj <arne@vajhoej.dk> wrote:
    On 11/20/2026 3:10 PM, Simon Clubley wrote:
    On 2026-11-20, Arne VajhĂžj <arne@vajhoej.dk> wrote:
    And for the curious - before fix:

    use_ssl = resource->scheme && (ZSTR_LEN(resource->scheme) > 4) &&
    ZSTR_VAL(resource->scheme)[4] == 's';

    I really hope that line was always compiled by a short-circuiting
    compiler and that line always successfully triggered short-circuiting...

    Doesn't C require/mandate short circuiting in cases like this??


    As Dan has pointed out, yes. However, I absolutely hate that style of
    coding (and the use of short circuiting in general) - it is way too fragile.

    It depends on the compiler behaving as expected and it depends on someone
    not making some edit change that happens to have the unexpected side-effect of disabling any working short circuiting.

    Seriously. Please consider not using short circuiting and instead writing your code so it works regardless of whether your compiler short-circuits
    or not. (Or it suddenly decides to stop short-circuiting one day).
    In general coding to protect against potential compiler
    bugs seems futile to me.

    Compiler bugs does happen, but this seems like a very
    unlikely one to happen.

    I know unlikely <> impossible, but preparing for
    unlikely compiler bugs does not make sense to me.

    I would be more attracted to the readability argument.

    That:

    IF e1 AND e2 THEN
    ...
    END IF

    would be more readable as:

    IF e1 THEN
    IF e2 THEN
    ...
    END IF
    END IF

    Because even though it seems highly unlikely that compiler writers
    does not know the rules for short circuit in the language they are implementing, then it could definitely happen that the
    application writer using the compiler does not.

    Arne



    --- Synchronet 3.21e-Linux NewsLink 1.2
  • From Lawrence =?iso-8859-13?q?D=FFOliveiro?=@ldo@nz.invalid to comp.os.vms on Mon Nov 23 22:46:24 2026
    From Newsgroup: comp.os.vms

    On Mon, 23 Nov 2026 16:38:33 -0500, Arne VajhĂžj wrote:

    That:

    IF e1 AND e2 THEN
    ...
    END IF

    would be more readable as:

    IF e1 THEN
    IF e2 THEN
    ...
    END IF
    END IF

    Ada had “and then” and “or else” to explicitly specify short-circuit evaluation. And the Algol 68 revival is proposing something similar <https://algol68-lang.org/>.
    --- Synchronet 3.21e-Linux NewsLink 1.2
  • From =?UTF-8?Q?Arne_Vajh=C3=B8j?=@arne@vajhoej.dk to comp.os.vms on Mon Nov 23 18:23:08 2026
    From Newsgroup: comp.os.vms

    On 11/23/2026 5:46 PM, Lawrence D’Oliveiro wrote:
    On Mon, 23 Nov 2026 16:38:33 -0500, Arne VajhĂžj wrote:
    That:

    IF e1 AND e2 THEN
    ...
    END IF

    would be more readable as:

    IF e1 THEN
    IF e2 THEN
    ...
    END IF
    END IF

    Ada had “and then” and “or else” to explicitly specify short-circuit evaluation. And the Algol 68 revival is proposing something similar <https://algol68-lang.org/>.

    And so does VMS Pascal. Just with underscore instead of space.

    Arne

    --- Synchronet 3.21e-Linux NewsLink 1.2
  • From cross@cross@spitfire.i.gajendra.net (Dan Cross) to comp.os.vms on Tue Nov 24 00:37:35 2026
    From Newsgroup: comp.os.vms

    In article <11e24vp$265v0$1@dont-email.me>,
    Simon Clubley <clubley@remove_me.eisner.decus.org-Earth.UFP> wrote:
    On 2026-11-20, Arne Vajhűj <arne@vajhoej.dk> wrote:
    On 11/20/2026 3:10 PM, Simon Clubley wrote:
    On 2026-11-20, Arne Vajhűj <arne@vajhoej.dk> wrote:
    On 11/19/2026 4:25 PM, Arne Vajhűj wrote:
    echo file_get_contents("http://arnepc5.vajhoej.dk/reveal.aspx") . "\n"; >>>>> //echo file_get_contents("https://arnepc5.vajhoej.dk/reveal.aspx") . "\n";
    echo file_get_contents("https://arnepc5.vajhoej.dk/reveal.aspx", false, >>>>> stream_context_create($sslctxopts)) . "\n";
    echo file_get_contents("HTTPS://arnepc5.vajhoej.dk/reveal.aspx") . "\n"; >>>>> echo file_get_contents("httpS://arnepc5.vajhoej.dk/reveal.aspx") . "\n"; >>>>
    $ php another.php
    Port = 80
    Port = 443
    Port = 80
    Port = 80
    And for the curious - before fix:

    use_ssl = resource->scheme && (ZSTR_LEN(resource->scheme) > 4) &&
    ZSTR_VAL(resource->scheme)[4] == 's';

    I really hope that line was always compiled by a short-circuiting
    compiler and that line always successfully triggered short-circuiting... >>>
    Don't be surprised if everyone is now looking for similar constructs
    that rely on short-circuiting to be safe.
    Doesn't C require/mandate short circuiting in cases like this??


    As Dan has pointed out, yes. However, I absolutely hate that style of
    coding (and the use of short circuiting in general) - it is way too fragile.

    It depends on the compiler behaving as expected and it depends on someone
    not making some edit change that happens to have the unexpected side-effect >of disabling any working short circuiting.

    I'm going to have to push back on this. Short-circuiting of
    boolean operators, in C, is a defined part _of the language_ and
    is specified by an international standard. If a compiler is
    miscompiling them, then that's a compiler bug or a language that
    is not C.

    Seriously. Please consider not using short circuiting and instead writing >your code so it works regardless of whether your compiler short-circuits
    or not. (Or it suddenly decides to stop short-circuiting one day).

    This begs the question: what other parts of the language should
    we not use?

    Oh, and before you all start mocking me, please read this:

    https://www.redhat.com/en/blog/security-flaws-caused-compiler-optimizations

    Apples and oranges, I'm afraid; that post concerns optimizations
    in the face of _undefined behavior_, which is a concept that is
    specified in the C standard. But short-circuiting is
    well-defined.

    Even Linux has been caught out in the past by compilers not behaving
    as expected.

    Linux is full of bugs, and that's exactly what this is. The
    compiler is right; Linux was wrong.

    Here's the TAP/TUN example from that post:

    1? static unsigned int tun_chr_poll(struct file *file, poll_table * wait)
    2? {
    3? struct tun_file *tfile = file->private_data;
    4? struct tun_struct *tun = __tun_get(tfile);
    5? struct sock *sk = tun->sk;
    6? unsigned int mask = 0;
    7? if (!tun)
    8? return POLLERR;

    The issue here is that dereferncing a NULL pointer is undefined
    behavior, which is behavior for which the C standard imposes
    abolutely _no_ requirements. Thus, a compiler is free to assume
    that it does not exist/does not occur; in this case, on line 5,
    we dereference `tun` (to get its `sk` member). But since
    deref'ing a NULL pointer is UB, the compiler is free to assume
    that it doesn't happen; then, on line 7, the compiler elides the
    conditional (and return) since it "knows" that `tun` cannot be
    nil, since it was dereferenced on line 5.

    But this is _qualitatively different_ than relying on
    short-circuiting for `&&` and `||`, which (again) is explicitly
    defined by the language.

    - Dan C.

    --- Synchronet 3.21e-Linux NewsLink 1.2
  • From Simon Clubley@clubley@remove_me.eisner.decus.org-Earth.UFP to comp.os.vms on Tue Nov 24 21:08:10 2026
    From Newsgroup: comp.os.vms

    On 2026-11-23, Dan Cross <cross@spitfire.i.gajendra.net> wrote:
    In article <11e24vp$265v0$1@dont-email.me>,
    Simon Clubley <clubley@remove_me.eisner.decus.org-Earth.UFP> wrote:

    As Dan has pointed out, yes. However, I absolutely hate that style of >>coding (and the use of short circuiting in general) - it is way too fragile. >>
    It depends on the compiler behaving as expected and it depends on someone >>not making some edit change that happens to have the unexpected side-effect >>of disabling any working short circuiting.

    I'm going to have to push back on this. Short-circuiting of
    boolean operators, in C, is a defined part _of the language_ and
    is specified by an international standard. If a compiler is
    miscompiling them, then that's a compiler bug or a language that
    is not C.

    Seriously. Please consider not using short circuiting and instead writing >>your code so it works regardless of whether your compiler short-circuits
    or not. (Or it suddenly decides to stop short-circuiting one day).

    This begs the question: what other parts of the language should
    we not use?


    In C, I would like to see people stop using library functions that have
    no way of doing bounded buffer copies (strcpy() and friends for example).
    I would say that is a common sense thing to ask for, but after some recent
    CVEs it would appear common sense is not all that common.

    Here's one I just found with a search:

    https://www.tenable.com/cve/CVE-2026-80671

    In C++, I would like to see people stop using unchecked bounds access
    (ie: []) to access containers and start using checked access (ie: at())
    always instead. It's insane that [] wasn't the checked option so you got
    safer code by default.

    BTW, I know some environments now allow [] to become checked. It would
    be nice to see that left enabled in production code, especially in
    today's environment.

    Of course, what I would _really_ like is to see safer languages used in
    our critical infrastructure. Said languages should also use readable
    syntax to make it easier to learn (Ada is far better than Rust here
    for example).

    Another minor annoyance of mine. When you write code, you are modelling
    a real-world problem. I hate that people sometimes run to using signed
    integers by default when most of the time, unsigned integers are a more accurate match. That's something that's more language-neutral however,
    except when dealing with languages that have unexpected side effects with
    mixed signed/unsigned expressions. :-)

    Simon.
    --
    Simon Clubley, clubley@remove_me.eisner.decus.org-Earth.UFP
    Walking destinations on a map are further away than they appear.
    --- Synchronet 3.21e-Linux NewsLink 1.2
  • From =?UTF-8?Q?Arne_Vajh=C3=B8j?=@arne@vajhoej.dk to comp.os.vms on Tue Nov 24 18:39:07 2026
    From Newsgroup: comp.os.vms

    On 11/24/2026 4:08 PM, Simon Clubley wrote:
    In C, I would like to see people stop using library functions that have
    no way of doing bounded buffer copies (strcpy() and friends for example).
    I would say that is a common sense thing to ask for, but after some recent CVEs it would appear common sense is not all that common.

    It is going that way.

    strlxxx/strxxx_s is taking over from strxxx and strnxxx.

    Just too bad that *nix and MS went different ways.

    C standard need to catch up.

    In C++, I would like to see people stop using unchecked bounds access
    (ie: []) to access containers and start using checked access (ie: at()) always instead. It's insane that [] wasn't the checked option so you got safer code by default.

    BTW, I know some environments now allow [] to become checked. It would
    be nice to see that left enabled in production code, especially in
    today's environment.

    +1

    Another minor annoyance of mine. When you write code, you are modelling
    a real-world problem. I hate that people sometimes run to using signed integers by default when most of the time, unsigned integers are a more accurate match.

    Neither −2147483648..2147483647 nor 0..4294967295 are likely
    to map to anything business relevant.

    1..10
    0..999
    etc.

    Arne

    --- Synchronet 3.21e-Linux NewsLink 1.2
  • From cross@cross@spitfire.i.gajendra.net (Dan Cross) to comp.os.vms on Wed Nov 25 00:25:01 2026
    From Newsgroup: comp.os.vms

    In article <11e4ubq$36gi8$1@dont-email.me>,
    Simon Clubley <clubley@remove_me.eisner.decus.org-Earth.UFP> wrote:
    On 2026-11-23, Dan Cross <cross@spitfire.i.gajendra.net> wrote:
    In article <11e24vp$265v0$1@dont-email.me>,
    Simon Clubley <clubley@remove_me.eisner.decus.org-Earth.UFP> wrote:

    As Dan has pointed out, yes. However, I absolutely hate that style of >>>coding (and the use of short circuiting in general) - it is way too fragile. >>>
    It depends on the compiler behaving as expected and it depends on someone >>>not making some edit change that happens to have the unexpected side-effect >>>of disabling any working short circuiting.

    I'm going to have to push back on this. Short-circuiting of
    boolean operators, in C, is a defined part _of the language_ and
    is specified by an international standard. If a compiler is
    miscompiling them, then that's a compiler bug or a language that
    is not C.

    Seriously. Please consider not using short circuiting and instead writing >>>your code so it works regardless of whether your compiler short-circuits >>>or not. (Or it suddenly decides to stop short-circuiting one day).

    This begs the question: what other parts of the language should
    we not use?

    In C, I would like to see people stop using library functions that have
    no way of doing bounded buffer copies (strcpy() and friends for example).

    Ok, but those are _library functions_. Short-circuiting of
    operators is a defined part _of the language_, not of a library.

    The short circuiting behavior is mandated; it does not depend on
    a compiler's whims or optimization levels. If it is not there,
    the compiler is broken: period.

    I would say that is a common sense thing to ask for, but after some recent >CVEs it would appear common sense is not all that common.

    Here's one I just found with a search:

    https://www.tenable.com/cve/CVE-2026-80671

    In C++, I would like to see people stop using unchecked bounds access
    (ie: []) to access containers and start using checked access (ie: at()) >always instead. It's insane that [] wasn't the checked option so you got >safer code by default.

    BTW, I know some environments now allow [] to become checked. It would
    be nice to see that left enabled in production code, especially in
    today's environment.

    I wasn't asking about C++, which is not the same language as C,
    but this is the same fundamental thing.

    Of course, what I would _really_ like is to see safer languages used in
    our critical infrastructure. Said languages should also use readable
    syntax to make it easier to learn (Ada is far better than Rust here
    for example).

    I agree that programmers should default to safe languages.
    Bluntly, very few people are qualified to program in systems
    languages.

    But I disagree that Ada is more readable than Rust, and I know
    other good judges who agree with me on that. Ada's syntax is
    overly verbose for no good reason; it gets in your way, which is
    an impediment to understanding.

    Further, I find its semantics wanting; we discussed the `'Valid`
    attribute here a while back, and I showed that it was both
    weaker than and less general than the `Result<T, E>` and
    `Option<T>` monads expressible with Rust's ADTs (and those of
    other languages).

    Another minor annoyance of mine. When you write code, you are modelling
    a real-world problem. I hate that people sometimes run to using signed >integers by default when most of the time, unsigned integers are a more >accurate match. That's something that's more language-neutral however,
    except when dealing with languages that have unexpected side effects with >mixed signed/unsigned expressions. :-)

    This is agree with.

    - Dan C.

    --- Synchronet 3.21e-Linux NewsLink 1.2