Conversation

Notices

  1. @moonman you know you can just restrict attachments allowed, right?

    $config['attachments']['supported'] = 'image/png,image/gif, etc, etc';

    Thursday, 01-Sep-16 07:24:25 UTC from community.highlandarrow.com
    1. @maiyannah different problem.

      Thursday, 01-Sep-16 07:25:28 UTC from shitposter.club
      1. @moonman What's up then?

        Thursday, 01-Sep-16 07:28:39 UTC from community.highlandarrow.com
        1. @maiyannah add that header I just posted to your http config.

          https://git.gnu.io/h2p/Qvitter/blob/master/js/dom-functions.js#L1287

          replace the "unescape"'ed portion in the link above with a hardcoded string or something.

          like, right now.

          Thursday, 01-Sep-16 07:30:14 UTC from shitposter.club
          1. @moonman Oh I am pretty sure I removed that a bit back because it could let people inject code into the javascript, unless it got added back in by a subsequent qvitter update.

            Let me guess, someone did that?

            Thursday, 01-Sep-16 07:32:18 UTC from community.highlandarrow.com
          2. @moonman @maiyannah you should mention me when you find stuff like this

            Thursday, 01-Sep-16 20:16:55 UTC from quitter.se
            1. @hannes2peer @maiyannah I'm sorry, I goofed. I thought somebody already did for some reason and I didn't want to flood your mentions.

              Friday, 02-Sep-16 01:34:13 UTC from shitposter.club
          3. @moonman @maiyannah but it's weird, i'm pretty sure gnusocial used to sanitize the source before.

            Thursday, 01-Sep-16 20:16:55 UTC from quitter.se
            1. @moonman @maiyannah i wonder if sanitation of the source got lost in the migration from saveNotice to saveActivity @mmn ?

              Thursday, 01-Sep-16 20:17:55 UTC from quitter.se
              1. @mmn @moonman @maiyannah the thing is that gs itself sends html in the source field in the api http://qttr.at/1gns

                Thursday, 01-Sep-16 20:19:42 UTC from quitter.se
                1. @hannes2peer @moonman @mmn Is source set at any point by qvitter, such as composing notices?

                  Thursday, 01-Sep-16 20:20:22 UTC from community.highlandarrow.com
                  1. @moonman @mmn @hannes2peer (Trying to think of how this exploit actually worked)

                    Thursday, 01-Sep-16 20:20:39 UTC from community.highlandarrow.com
                    1. @maiyannah the user (client) can send a any "source" when posting to api. imo it should be treated/sanitised by gs just like the notice text

                      Thursday, 01-Sep-16 20:35:25 UTC from quitter.se
                      1. @hannes2peer Agree, I thought it was put through HTMLPurifier like the rest, though?

                        Thursday, 01-Sep-16 20:36:42 UTC from community.highlandarrow.com
                        1. @maiyannah apparently not

                          Thursday, 01-Sep-16 20:43:29 UTC from quitter.se
                        2. @hannes2peer Looking now, as far as I can tell /lib/apistatusesupdate.php just takes  $this->source; without any filtering, unless it happens elsewhere in the code and I am missing it.

                          Thursday, 01-Sep-16 20:43:55 UTC from community.highlandarrow.com
                          1. @hannes2peer cc @mmn

                            Thursday, 01-Sep-16 20:44:09 UTC from community.highlandarrow.com
                            1. @mmn @hannes2peer https://git.gnu.io/gnu/gnu-social/blob/master/actions/apistatusesupdate.php#L315

                              Only thing I see before then is a check to make sure it's not empty.

                              Thursday, 01-Sep-16 20:49:45 UTC from community.highlandarrow.com
                              1. @maiyannah this is what i did to !qvitter https://git.gnu.io/h2p/Qvitter/commit/632d5f113627df4c158be973aefc1afc018764f4

                                Thursday, 01-Sep-16 20:58:56 UTC from quitter.se
                                1. @hannes2peer For GS end, do you think cleaning it in the same way as a notice text gets, is enough?

                                  Thursday, 01-Sep-16 20:59:54 UTC from community.highlandarrow.com
                                  1. @maiyannah yes htmlpurifier should be enough, i guess?

                                    Thursday, 01-Sep-16 21:02:35 UTC from quitter.se
                                    1. @hannes2peer I will make this change to my fork that some people use at least.

                                      Thursday, 01-Sep-16 21:03:01 UTC from community.highlandarrow.com
                                    2. @maiyannah @mmn although, it would be interesting to see if anyone could come up with a dangerous script with only 32 chars

                                      Thursday, 01-Sep-16 21:12:53 UTC from quitter.se
                                      1. @hannes2peer @mmn I think they made the link go somewheres and that's how they managed it?  @moonman could tell you, it was his instance that was affected directly, the others were just affected indirectly from federated posts.

                                        Thursday, 01-Sep-16 21:13:43 UTC from community.highlandarrow.com
                                        1. @mmn @hannes2peer ... @moonman, for some reason on my end that didn't link.

                                          Thursday, 01-Sep-16 21:14:13 UTC from community.highlandarrow.com
                                        2. @maiyannah ok. but the source field is not federated.

                                          Thursday, 01-Sep-16 21:14:51 UTC from quitter.se
                                          1. @hannes2peer This is why I don't have a good idea really what the vector was.  I was just a spectator trying to help out.

                                            Thursday, 01-Sep-16 21:15:16 UTC from community.highlandarrow.com
                                      2. @maiyannah @mmn e.g. i could do <script>alert("hello")</script> but not <script>console.log("hello")</script>

                                        Thursday, 01-Sep-16 21:14:13 UTC from quitter.se
                                    3. @hannes2peer Reasonably source shouldn't be html at all! So just escaping it on output is good enough I think.

                                      Thursday, 01-Sep-16 21:45:18 UTC from social.umeahackerspace.se at 63°49'42"N 20°15'34"E
                                      1. @hannes2peer @maiyannah I've been looking at it now and I'm curious where someone can put their own URL in there in a way that will be output to !qvitter since it's only HTML if Notice->getSource returns a Notice_source object, which should be under server control and not affected by user input.

                                        Thursday, 01-Sep-16 22:21:36 UTC from social.umeahackerspace.se at 63°49'42"N 20°15'34"E
                                        1. @mmn Notice_source is only for known sources. unknown sources are served directly from the notice table

                                          Thursday, 01-Sep-16 22:26:58 UTC from quitter.se
                                        2. @hannes2peer @maiyannah Ah no alright, I didn't read the whole getSource function: https://social.umeahackerspace.se/url/94331

                                          That thing means API clients can choose their own source names (which is a good thing) and match against OAuth applications (matching up so the name gets linked).

                                          It's when the HTML in !GNUsocial gets built that nasty stuff get in. I have now redacted this whole procedure and the URL is sent as source_link, separately from the name (which is now never HTML).

                                          Thursday, 01-Sep-16 22:43:55 UTC from social.umeahackerspace.se at 63°49'42"N 20°15'34"E
                                          1. @hannes2peer @maiyannah @moonman what I did (mostly the second link):
                                            https://git.gnu.io/gnu/gnu-social/commit/15ab9ff9e3303255ff14166ee86ffdf3bc4f52ce
                                            https://git.gnu.io/gnu/gnu-social/commit/a7043bf7cc6956abd344149332290564eda5d1f4

                                            Thursday, 01-Sep-16 23:10:28 UTC from social.umeahackerspace.se at 63°49'42"N 20°15'34"E
                          2. @hannes2peer (Which is entirely possible, I am not very familiar with the API side of things yet.)

                            Thursday, 01-Sep-16 20:44:47 UTC from community.highlandarrow.com
                        3. @maiyannah and now we'll have to assume it might have not, even if it's fixed in newer gnusocial

                          Thursday, 01-Sep-16 20:44:05 UTC from quitter.se
                    2. @maiyannah @mmn @hannes2peer I have a copy of my db before I cleansed notices etc. It looked like it relied on the fact that html is very forgiving of malformed tags, and the injected domain was short.

                      Friday, 02-Sep-16 01:36:11 UTC from shitposter.club
                      1. @moonman @mmn @hannes2peer I cant speak for the other two but I'd be curious to see the payload and specific effect, you have my email and should have my PGP if you want to keep it secure.

                        Friday, 02-Sep-16 01:37:46 UTC from community.highlandarrow.com
                        1. @moonman @mmn @hannes2peer ... I always FrankerZ that acronym up.

                          Friday, 02-Sep-16 01:38:01 UTC from community.highlandarrow.com
                  2. @maiyannah yes

                    Thursday, 01-Sep-16 20:31:41 UTC from quitter.se
                2. @mmn @moonman @maiyannah and clients has no way to tell if the html comes from gs or is injected by the user.

                  Thursday, 01-Sep-16 20:21:37 UTC from quitter.se