[02:57:24] hi TimStarling [02:59:06] Are any of you here for the Lua/Scribunto office hour? [02:59:12] (wait that would be Wednesday, never mind) [02:59:31] Tomorrow! in 23 hours! [02:59:32] * sumanah flees to escape her datetime-related shame [16:54:43] will the training be broadcast to youtube? [16:55:46] qgil: ^ [16:55:48] Also curious about the training - youtube? hangout? [16:56:31] hi, no, most of the training is about you watching the videos, now we will focus on questions and more here on IRC [16:56:44] awesome. [16:57:23] in the video you would ave seen Christ talking about some Security topics... just like he is doing in one of the two videos provided :) [16:57:31] We rather go for direct questions and support here [16:57:32] haha, if it's about watching videos, why set a dedicated time?:P [16:57:50] MaxSem, you were supposed to watch the videos BEFORE :) [16:58:11] qgil, I've seen it with my own eyes IRL;P [16:58:34] "ave seen Christ" [16:58:38] AMEN! [16:59:06] * YuviPanda puts that in bugzilla quips [16:59:47] done [16:59:54] Still many pages on MediaWiki are still referring to "edittoken()". Should be replace with "getEditToken()" in my view [17:00:13] {{sofixit}} [17:00:25] Cannot bulk rename strings ! [17:01:22] Is there any point joining the hangout? [17:01:38] is there a hangout? [17:01:51] yes, see wikitech-l [17:02:11] MaxSem: https://www.mediawiki.org/wiki/ReplaceText needs to enabled [17:02:21] no it doesn't [17:02:28] get awb and do the changes yourself [17:02:33] security office hours starting! [17:02:54] * MaxSem puts on his trolling hat [17:03:06] * Emufarmers glares at MaxSem. [17:03:41] Has everyone looked at TIm's talk (link in the email)?> [17:03:46] Aye. [17:03:49] yep [17:03:51] yessir [17:03:55] checkmark [17:03:57] I attended it when he gave it in Berlin ;) [17:04:02] +1 [17:04:35] csteipp, is there any point joining the hangout? [17:04:54] Krenair: Probably not [17:05:04] Let's focus here on IRC first [17:05:10] So to start: Any questions from the videos? [17:05:20] For reference: https://www.mediawiki.org/wiki/Security_for_developers [17:05:33] htmlspecialchars vs htmlentities? [17:05:37] The MUST WATCH video: http://vimeo.com/album/2013929/video/44856793 [17:05:49] your typing hurts my ears csteipp ;-) [17:06:11] (To review: XSS, CSRF, Register globals, SQLi) [17:06:15] The GOOD TO WATCH video: https://commons.wikimedia.org/wiki/File:MediaWiki_Security.ogv [17:06:17] jdlrobson: sorry about that! [17:06:37] ... and the related slides: https://commons.wikimedia.org/wiki/File:TechDays2012-SecureCoding.pdf [17:06:37] gnorlock, htmlentities is more thorough, but MediaWiki has Html and Xml classes that are meant to make it easier still (and do other things). [17:06:38] gnorlock: Good question, and I'll refer you to the php docs for that [17:06:49] We are assuming all you found the time to watch those materials. Question? [17:06:59] Yep, using htmlspecialchars is typically what we use [17:07:11] https://www.owasp.org/index.php/Special:Version is running MediaWiki 1.18 :v [17:07:29] As Tim mentioned, the best way to avoid XSS is using the Html and Xml classes for builders [17:07:56] (includes/Html.php / Xml.php ) [17:08:24] Emufarmers, so hack those security experts:P [17:08:50] MaxSem: right, I was wondering whether it was some sort of interactive demo so people could try out the attacks detailed on the site. :-) [17:09:14] Of special note however, when reviewing code, make sure that you're careful about Html::rawElement(), Xml::tags, and Linker::links() [17:09:37] Those do *not* escape the html strings that you pass in [17:10:12] Otherwise, most of the Html, Xml, and Linker functions do escape what you pass in based on the context where it's writing out [17:10:22] One thing that Tim didn't mention [17:10:28] was Dom-Based XSS [17:10:37] Is that a familiar topic to anyone? [17:10:51] Yes, generally [17:11:01] E.g. $.html vs. $.text and $.attr [17:11:12] Cool. Does anyone here work in Javascript, and are not familiar with dom-based xss? [17:11:24] superm401: Yep, exactly [17:11:25] I'm not too familiar with it. [17:11:47] I think I see where you're going with that -- but I've not encountered it formally [17:11:51] I haven't heard it be referred to with that name before, but. [17:11:52] Right, so it's especially important when reviewing or writing javascript [17:12:13] I am also not super familiar with it - I was confused as to whether you should 'never' use them, or you should just never use them with user input? [17:12:21] https://www.mediawiki.org/w/index.php?title=DOM-based_XSS [17:12:34] gnorlock: Never without escaped user input [17:12:36] :) [17:12:46] So yes, there are times when you will have to use them [17:12:53] But be very careful about how you do it [17:13:23] Basically, 50% of the XSS vulnerabilities we've fixed on WMF websites have come from javascript [17:13:33] So it's a problem we need to watch out for [17:13:37] this was a pretty good press on classifying xss: http://videos.2012.appsecusa.org/video/54157395 [17:14:03] Thanks dr0ptp4kt, that was a good presentation [17:14:58] So to avoid these type of xss, creating elements, appending attributes by key-value pairs, and then appending the dom object is a good habit to be in [17:15:06] wow 50%? that's surprisingly high [17:15:11] Why are users still allowed to change each other's javascript or have global (skin/'common') JS? [17:15:24] Krenair, only admins can change others' JS, right? [17:15:34] Right. [17:15:35] ergg Common.js :P [17:15:42] By default, yeah. (trwiki is an exception) [17:15:46] What do you mean global, MediaWiki:Common.js or User:Krenair/common.js? [17:15:46] yep, only admin can, and I've used that right to fix a couple of these xss [17:15:57] That seems like a dangerous exception. Why is it allowed? [17:16:00] Common.js doesn't affect some things, no? [17:16:13] superm401, MediaWiki:*.js and User:Krenair/*.js [17:16:20] A wiki that allows anyone to modify other people's js files would be very insecure [17:16:25] superm401, it's still only approved people [17:16:32] Oh, okay. [17:16:46] Cool. Any other questions on XSS? [17:16:55] Isarra, both the site common and user common always load if non-empty. [17:17:12] Even on preferences? [17:17:13] I did not understand the XSSI example [17:17:22] superm401: no, not on the login page and such, as I recall [17:17:23] Isarra, it's just arbitrary JS. It can do anything JS can. [17:17:35] (on trwiki admins and technicians ('Teknisyenler') have edituserjs) [17:17:35] Emufarmers, true, didn't know that's what he meant. [17:17:36] Wikinaut: I will get to that :) [17:17:41] She I mean. :) [17:17:43] I know gadgets don't load on preferences. [17:18:01] Ok, next up is CSRF [17:18:04] Ah, login page would be a sensible exception. [17:18:37] (and that is also why we do not have 'ajax login', IIRC - where the login is just an ajax popup) [17:18:41] Anyone want to give a basic description of what CSRF is? [17:18:48] csteipp: general info: many pages on MediaWiki are still referring to "edittoken()". Should be replaced with "getEditToken()" in my view (I was bashed on that to do that by myself...) [17:19:15] I mean: the security documentation should be up to date [17:19:29] Wikinaut: yep, getEditToken is the right one... I will make a note to update those [17:19:30] w.r.t. core / master [17:19:33] YuviPanda: There are other reasons for that [17:19:43] csteipp: thank you [17:20:04] for JS - was this the function that Tim was referring to as being removed? mw.user.tokens.get( 'editToken' ) [17:20:15] RoanKattouw: oh? IIRC that was the primary one, with the other thing being something https related? (vague recollection only, sorry!) [17:20:29] YuviPanda: It's only secure if the entire page is delivered over HTTPS [17:20:35] ah, right. [17:20:43] An AJAX popup from an HTTP page basically can't be secure [17:20:45] pointless to ajax to https [17:20:49] from http [17:21:06] But our credentials currently go over HTTP anyway, right (by default)? [17:21:06] gnorlock: I don't think that was the one, there was a javascript file that included something like [17:21:08] since any attacker can simply modify the http page / js. [17:21:15] qgil: can you pls. also add url where this chat is logged ? [17:21:22] YuviPanda: Yeah exactly, they can modify the JS that calls the HTTPS [17:22:01] Logins will soon all be going over HTTPS, that is a basic security assumption that we sadly do not enforce by default right now. [17:22:11] Wait [17:22:15] This is about WMF-specific security? [17:22:26] You can't enforce all logins over HTTPS in MediaWiki itself [17:22:34] Krenair, it's already a flag. [17:22:38] Krenair: WMF sites only :) [17:22:41] Though IIRC, there might be a bug. [17:23:05] that's not entirely true - the mobile version of the WMF sites forces https at login [17:23:05] Security for developers training - Useful links: http://lists.wikimedia.org/pipermail/wikitech-l/2013-March/067630.html - Channel log: http://bots.wmflabs.org/~wm-bot/logs/%23wikimedia-office/?C=M;O=D - http://meta.wikimedia.org/wiki/IRC_office_hours [17:23:17] Ok, Wikinaut, since we're talking about XSSI (since it's often used for CSRF), did you have a specific question about it? [17:23:19] awjr, good to know. [17:23:23] Wikinaut, done and good point. I'll copy paste the log of this session elsewhere [17:23:38] Krenair: sort of: https://www.mediawiki.org/wiki/Manual:$wgSecureLogin [17:23:56] Most MediaWikis probably aren't accessible over HTTPS [17:24:04] Really, though, HTTPS only at login is not enough. It doesn't deal with a Firesheep-style attack. [17:24:15] I know we're looking at HTTPS for logged in users everywhere eventually. [17:24:16] the example was short. need to look to it again. One moment [17:24:24] csteipp: ^ [17:24:42] The basic concept being that a hostile website loads in a page from our website, [17:24:44] something like [17:24:48] Krenair: right. That's why it defaults to false (and probably always will) :p [17:25:05]