X-Git-Url: http://git.vanrenterghem.biz/git.ikiwiki.info.git/blobdiff_plain/cb777df0415cfad80a3725387b5fdbf5c95b8941..415c8e0cb53daec6fff7e2a8f3346efd0958008d:/doc/security.mdwn diff --git a/doc/security.mdwn b/doc/security.mdwn index 34f820f6e..52ef486e6 100644 --- a/doc/security.mdwn +++ b/doc/security.mdwn @@ -41,11 +41,19 @@ who's viewing the wiki, that can be a security problem. Of course nobody else seems to worry about this in other wikis, so should we? -Currently only people with direct svn commit access can upload such files -(and if you wanted to you could block that with a svn pre-commit hook). -Users with only web commit access are limited to editing pages as ikiwiki -doesn't support file uploads from browsers (yet), so they can't exploit -this. +People with direct commit access can upload such files +(and if you wanted to you could block that with a pre-commit hook). + +The attachments plugin is not enabled by default. If you choose to +enable it, you should make use of its powerful abilities to filter allowed +types of attachments, and only let trusted users upload. + +It is possible to embed an image in a page edited over the web, by using +`img src="data:image/png;"`. Ikiwiki's htmlscrubber only allows `data:` +urls to be used for `image/*` mime types. It's possible that some broken +browser might ignore the mime type and if the data provided is not an +image, instead run it as javascript, or something evil like that. Hopefully +not many browsers are that broken. ## multiple accessors of wiki directory @@ -57,16 +65,16 @@ So it's best if only one person can ever directly write to those directories. ## setup files -Setup files are not safe to keep in subversion with the rest of the wiki. -Just don't do it. [[ikiwiki.setup]] is *not* used as the setup file for -this wiki, BTW. +Setup files are not safe to keep in the same revision control repository +with the rest of the wiki. Just don't do it. [[ikiwiki.setup]] is *not* +used as the setup file for this wiki, BTW. -## page locking can be bypassed via direct svn commits +## page locking can be bypassed via direct commits -A locked page can only be edited on the web by an admin, but -anyone who is allowed to commit direct to svn can bypass this. This is by -design, although a subversion pre-commit hook could be used to prevent -editing of locked pages when using subversion, if you really need to. +A locked page can only be edited on the web by an admin, but anyone who is +allowed to commit directly to the repository can bypass this. This is by +design, although a pre-commit hook could be used to prevent editing of +locked pages, if you really need to. ## web server attacks @@ -98,7 +106,7 @@ your web server will not run it. ## suid wrappers -ikiwiki --wrapper is intended to generate a wrapper program that +`ikiwiki --wrapper` is intended to generate a wrapper program that runs ikiwiki to update a given wiki. The wrapper can in turn be made suid, for example to be used in a [[post-commit]] hook by people who cannot write to the html pages, etc. @@ -111,9 +119,13 @@ been no problem yet. ## shell exploits ikiwiki does not expose untrusted data to the shell. In fact it doesn't use -system() at all, and the only use of backticks is on data supplied by the -wiki admin and untainted filenames. And it runs with taint checks on of -course.. +`system(3)` at all, and the only use of backticks is on data supplied by the +wiki admin and untainted filenames. + +Ikiwiki was developed and used for a long time with perl's taint checking +turned on as a second layer of defense against shell and other exploits. Due +to a strange [bug](http://bugs.debian.org/411786) in perl, taint checking +is currently disabled for production builds of ikiwiki. ## cgi data security @@ -122,8 +134,8 @@ page to edit. It has to make sure to sanitise this page, to prevent eg, editing of ../../../foo, or editing of files that are not part of the wiki, such as subversion dotfiles. This is done by sanitising the filename removing unallowed characters, then making sure it doesn't start with "/" -or contain ".." or "/.svn/". Annoyingly ad-hoc, this kind of code is where -security holes breed. It needs a test suite at the very least. +or contain ".." or "/.svn/", etc. Annoyingly ad-hoc, this kind of code is +where security holes breed. It needs a test suite at the very least. ## CGI::Session security @@ -134,15 +146,15 @@ file not be world readable. ## cgi password security -Login to the wiki involves sending a password in cleartext over the net. -Cracking the password only allows editing the wiki as that user though. -If you care, you can use https, I suppose. If you do use https either for -all of the wiki, or just the cgi access, then consider using the sslcookie -option. +Login to the wiki using [[plugins/passwordauth]] involves sending a password +in cleartext over the net. Cracking the password only allows editing the wiki +as that user though. If you care, you can use https, I suppose. If you do use +https either for all of the wiki, or just the cgi access, then consider using +the sslcookie option. Using [[plugins/openid]] is a potentially better option. ## XSS holes in CGI output -ikiwiki has not yet been audited to ensure that all cgi script input/output +ikiwiki has been audited to ensure that all cgi script input/output is sanitised to prevent XSS attacks. For example, a user can't register with a username containing html code (anymore). @@ -204,13 +216,13 @@ wouldn't see. To avoid this, ikiwiki will skip over symlinks when scanning for pages, and uses locking to prevent more than one instance running at a time. The lock -prevents one ikiwiki from running a svn up at the wrong time to race -another ikiwiki. So only attackers who can write to the working copy on -their own can race it. +prevents one ikiwiki from running a svn up/git pull/etc at the wrong time +to race another ikiwiki. So only attackers who can write to the working +copy on their own can race it. ## symlink + cgi attacks -Similarly, a svn commit of a symlink could be made, ikiwiki ignores it +Similarly, a commit of a symlink could be made, ikiwiki ignores it because of the above, but the symlink is still there, and then you edit the page from the web, which follows the symlink when reading the page (exposing the content), and again when saving the changed page (changing @@ -341,7 +353,58 @@ There are at least two configurations where this is exploitable: notice. This security hole was discovered on 26 November 2007 and fixed the same -da with the release of ikiwiki 2.14. I recommend upgrading to this version +day with the release of ikiwiki 2.14. I recommend upgrading to this version if your wiki can be committed to by third parties. Alternatively, don't use a trailing slash in the srcdir, and avoid the (unusual) configurations that allow the security hole to be exploited. + +## javascript insertion via uris + +The htmlscrubber did not block javascript in uris. This was fixed by adding +a whitelist of valid uri types, which does not include javascript. +([[cve CVE-2008-0809]]) Some urls specifyable by the meta plugin could also +theoretically have been used to inject javascript; this was also blocked +([[cve CVE-2008-0808]]). + +This hole was discovered on 10 February 2008 and fixed the same day +with the release of ikiwiki 2.31.1. (And a few subsequent versions..) +A fix was also backported to Debian etch, as version 1.33.4. I recommend +upgrading to one of these versions if your wiki can be edited by third +parties. + +## Cross Site Request Forging + +Cross Site Request Forging could be used to constuct a link that would +change a logged-in user's password or other preferences if they clicked on +the link. It could also be used to construct a link that would cause a wiki +page to be modified by a logged-in user. ([[cve CVE-2008-0165]]) + +These holes were discovered on 10 April 2008 and fixed the same day with +the release of ikiwiki 2.42. A fix was also backported to Debian etch, as +version 1.33.5. I recommend upgrading to one of these versions. + +## Cleartext passwords + +Until version 2.48, ikiwiki stored passwords in cleartext in the `userdb`. +That risks exposing all users' passwords if the file is somehow exposed. To +pre-emtively guard against that, current versions of ikiwiki store password +hashes (using Eksblowfish). + +If you use the [[plugins/passwordauth]] plugin, I recommend upgrading to +ikiwiki 2.48, installing the [[cpan Authen::Passphrase]] perl module, and running +`ikiwiki-transition hashpassword` to replace all existing cleartext passwords +with strong blowfish hashes. + +You might also consider changing to [[plugins/openid]], which does not +require ikiwiki deal with passwords at all, and does not involve users sending +passwords in cleartext over the net to log in, either. + +## Empty password security hole + +This hole allowed ikiwiki to accept logins using empty passwords, to openid +accounts that didn't use a password. It was introduced in version 1.34, and +fixed in version 2.48. The [bug](http://bugs.debian.org/483770) was +discovered on 30 May 2008 and fixed the same day. ([[cve CVE-2008-0169]]) + +I recommend upgrading to 2.48 immediatly if your wiki allows both password +and openid logins.