Live data from Hacker News

Hidden Messages in Emojis and Hacking the US Treasury

slamdunksoftware.substack.com

41–50 of 82 posts

Re: Hidden Messages in Emojis and Hacking the US Treasury

#41
A while back I stumbled on a way to crash my company’s Jira server simply by sending an email to it containing an emoji. Makes me wonder if that could have been abused by malicious parties if they knew the email address we used to forward new support issues to Jira.

Re: Hidden Messages in Emojis and Hacking the US Treasury

#42

Earlier quoted context omitted.

The only reason BeyondTrust implemented that was it wasn't untrusted user commands . They sanitized the data, so it should have been fine. The unfortunate problem was that the sanitizer didn't sanitize. Systems are built on a set of expectations. Undermine the expectations and you undermine the system.

> They sanitized the data, so it should have been fine. This is a 101 rookie level approach to SQL or injection defense. It's dumb for exactly the same reason why this is dumb "SELECT * FROM foo WHERE bar=" + sanitize(userInput) The correct way to do something like this will always be parameterized input which looks something like this "SELECT * FROM foo WHERE bar=?" bindParameter(1, userInput); Why? Because that the…

The more you work in software the more you should realize the developers writing security-critical software (in this case the one writing that sanitizer) are often/usually as clueless as you are. The solution? Hard to say.

Re: Hidden Messages in Emojis and Hacking the US Treasury

#43
post #19
post #5

I learned about the breach a few days ago but I didn't know that you could "adopt" an emoji: https://aac.unicode.org/sponsors That's a neat tidbit.

Does "adopting an emoji" mean something other than "appearing on that page"? From the adoption page: Each adoption comes with a digital badge and certificate that you can proudly display.

[deleted]

Re: Hidden Messages in Emojis and Hacking the US Treasury

#44
I got nerd sniped by a recent xkcd.

https://xkcd.com/3054/ (the scream cypher)

And halfway through implementing it. I realized that these combining characters will attach to any letter, and it would be easy to have crappy stegonography on top of your crappy ceaser cypher.

Probably nothing new, but I had fun.

D̊o̝ n̝o̊ť f̔o͞r̊g̝e͞t̍ t̊h̠e̗ milk

    import string
    
    def combine_list():
            l = []
            for c in range(0x0300, 0x0370):
                    if c != 0x340f: #non joiner mark
                            l.append(chr(c))
                    #print(str(c), 'A' + chr(c))
            return l
    
    class codebook_a():
            def __init__(self):
                    self.cb = dict(zip(string.printable, combine_list()))
                    self.cb[''] = ''
                    self.d = {}
                    for c in self.cb:
                            self.d[self.cb[c]] = c
            def encode(self, message, fake):
                    if len(message) > len(fake):
                            raise ValueError('fake must be longer than message')
                    ml = list(message)
                    fl = list(fake)
                    encode = []
                    while fl:
                            c = fl.pop(0)
                            if c != ' ':
                                    if ml:
                                            m = ml.pop(0)
                                    else:
                                            m = ''
                                    encode.append(c + self.cb[m])
                            else:
                                    encode.append(c)  
                    return ''.join(encode)
            def decode(self, message):
                    plain = []
                    for c in message:
                            p = self.d.get(c)
                            if p is not None:
                                    plain.append(p)
                    return ''.join(plain)
    def cli(args):
            cb = codebook_a()
            #check for coded text
            if len(args) == 0:
                    print('message fake : two args')
                    print('a message with no combining charactors(dicritics) will be coded onto fake')
                    print('with combining charactors will extract the real message')
                    return 1
            m = args[0]
            for c in m:
                    if cb.d.get(c):
                            print('decode')
                            print(cb.decode(m))
                            return 0
            print('encode')
            print(cb.encode(m, args[1]))

    if __name__ == '__main__':
            import sys
            cli(sys.argv[1:])

Re: Hidden Messages in Emojis and Hacking the US Treasury

#45
post #7

> Now, all of this might have been fine had Beyond Trust not written a feature which allowed users to directly, programmatically interact with psql (the postgres command line interface). That's the buried lede. Yes, there was a vulnerability in psql... but that's so much less a problem than the huge gaping hole of allowing users to directly interact with psql. No DB can be safe if you are turning untrusted user comma…

There is an interesting project https://github.com/Abstrct/Schemaverse where the whole game takes place entirely within a postgres database that the players connect directly to.

The author discovered quite a few... well lets just call them policy errors in postgres, but had a hard time filing bug reports, mainly because the response was usually an incredulous "why on earth would you even do that in the first place?.

But the author has fun with this, There is a trophy in the game that you can only get by putting your name in the trophy table.

Re: Hidden Messages in Emojis and Hacking the US Treasury

#46
post #19
post #5

I learned about the breach a few days ago but I didn't know that you could "adopt" an emoji: https://aac.unicode.org/sponsors That's a neat tidbit.

Does "adopting an emoji" mean something other than "appearing on that page"? From the adoption page: Each adoption comes with a digital badge and certificate that you can proudly display.

It also appears to be a $5k permanent backlink from unicode.org, custom anchor text even.

Re: Hidden Messages in Emojis and Hacking the US Treasury

#47

Earlier quoted context omitted.

The only reason BeyondTrust implemented that was it wasn't untrusted user commands . They sanitized the data, so it should have been fine. The unfortunate problem was that the sanitizer didn't sanitize. Systems are built on a set of expectations. Undermine the expectations and you undermine the system.

> They sanitized the data, so it should have been fine. This is a 101 rookie level approach to SQL or injection defense. It's dumb for exactly the same reason why this is dumb "SELECT * FROM foo WHERE bar=" + sanitize(userInput) The correct way to do something like this will always be parameterized input which looks something like this "SELECT * FROM foo WHERE bar=?" bindParameter(1, userInput); Why? Because that the…

100%.

Btw, even using psql directly allows binding parameters https://www.postgresql.org/docs/current/app-psql.html

Re: Hidden Messages in Emojis and Hacking the US Treasury

#48

Earlier quoted context omitted.

The only reason BeyondTrust implemented that was it wasn't untrusted user commands . They sanitized the data, so it should have been fine. The unfortunate problem was that the sanitizer didn't sanitize. Systems are built on a set of expectations. Undermine the expectations and you undermine the system.

> They sanitized the data, so it should have been fine. This is a 101 rookie level approach to SQL or injection defense. It's dumb for exactly the same reason why this is dumb "SELECT * FROM foo WHERE bar=" + sanitize(userInput) The correct way to do something like this will always be parameterized input which looks something like this "SELECT * FROM foo WHERE bar=?" bindParameter(1, userInput); Why? Because that the…

[deleted]

Re: Hidden Messages in Emojis and Hacking the US Treasury

#49
post #4

So many questions: - why a no side-effects function on a database can be used to get lateral access to the whole database instance - why do you need to validate strings on the database itself and not on the client anyway, heck why are there no type safe way of doing it - why would you want to execute shell commands from the database itself - Even if there's a real use case for executing commands like that why is it e…

They mentioned PAM module so maybe the sql injection just allowed bypassing the authorization of a system that was using the PAM module. Like it’s in the realm of possibility that a PAM module that wanted to validate a user against credentials stored in a pg database might shell out to the psql command to do this. Though, the whole thing is very questionable.

In this case PAM is the name of a type of security product and not the Linux PAM system.

Re: Hidden Messages in Emojis and Hacking the US Treasury

#50

Earlier quoted context omitted.

The only reason BeyondTrust implemented that was it wasn't untrusted user commands . They sanitized the data, so it should have been fine. The unfortunate problem was that the sanitizer didn't sanitize. Systems are built on a set of expectations. Undermine the expectations and you undermine the system.

> They sanitized the data, so it should have been fine. This is a 101 rookie level approach to SQL or injection defense. It's dumb for exactly the same reason why this is dumb "SELECT * FROM foo WHERE bar=" + sanitize(userInput) The correct way to do something like this will always be parameterized input which looks something like this "SELECT * FROM foo WHERE bar=?" bindParameter(1, userInput); Why? Because that the…

> The correct way to do something like this will always be parameterized input which looks something like this

> Why? Because [] the postgres protocol splits out the command and the data for the command in a way that can't be injected.

I'm not sure I'm comfortable with this. You can create a prepared statement and then pass user input to it as parameters, sure. https://www.postgresql.org/docs/17/sql-prepare.html

But who says that means your statement can't be injected? It would have to be true that the handling for EXECUTE statements is bug-free. Maybe it is bug-free. Or maybe it isn't. Maybe I can figure out just the right username to cause your prepared statement to have some undesirable side effects.

That wouldn't be SQL injection in the sense of putting hostile values into an SQL query in order to form a different SQL query, but it would be SQL injection in the sense of putting hostile values into an SQL query in order to accomplish nefarious goals via the database. The only real qualm I'd have about calling it "SQL injection" is that it wouldn't be portable across different database implementations; it would be more accurately described as "PostgreSQL injection".

If we feel entitled to assume that PostgreSQL's provided functionality to interpret strings that are provided to EXECUTE statements has no bugs, why aren't we also entitled to assume that PostgreSQL's provided functionality to interpret strings that are provided to the string escaper has no bugs? I don't really see the conceptual difference.

Post reply on HN