Comment by netsharc

Comment by netsharc 3 months ago

21 replies

Reminds me of an anecdote about an e-commerce platform: someone coded a leaky webshop, so their workaround was to watch if the string "OutOfMemoryException" shows up in the logs, and then restart the app.

Another developer in the team decided they wanted to log what customers searched for, so if someone typed in "OutOfMemoryException" in the search bar...

PhilipRoman 3 months ago

Careless analysis of free-form text logs is an underrated way to exploit systems. It's scary how much software blindly logs data without out of band escaping or sanitizing.

  • ycombinatrix 3 months ago

    Why would someone "sanitize" OutOfMemoryException out of their logs? That is a silly point to make.

    • teraflop 3 months ago

      The point is not to sanitize known strings like "OutOfMemoryException". The point is to sanitize or (preferably) escape any untrusted data that gets logged, so that it won't be confused for something else.

      • swyx 3 months ago

        i think GP's point is how would you even sanitize the string "OutOfMemoryException" which presumably comes from a trusted system

        i guess demanding "Structured logs for everything or bust" is the answer? (i'm not a big o11y guy so pardon me if this is obvious)

    • owebmaster 3 months ago

      An OutOfMemoryException log should not be the same as a search log

        Error: OutOfMemoryException
      
      And

        Search: OutOfMemoryException
      
      Should not be related in any way
      • dusanz 3 months ago

        Until someone searches for "Error: OutOfMemoryException"

    • MortyWaves 3 months ago

      Absolutely incredible how dense HN can be and that no one has explained. Obviously that isn’t what they are saying, they are saying it’s profoundly stupid to have the server be controlled by a simple string search at all.

skipants 3 months ago

I've actually gone through this a few times with our WAF. A user got IP-banned because the WAF thought a note with the string "system(..." was PHP injection.