It's sad to see this useful module removed from security team coverage because of an unresolved issue.
When this happened, I followed the instructions at https://www.drupal.org/node/251466 and sent the security team an email. Nobody replied. Since then, the flaw has been posted in this issue ([#3098700@5]), and I've prepared a patch to fix it.
This is now waiting for Security Team approval and/or further work to be identified.
This module is used by a couple of thousand live sites. That figure hasn't dropped much since the security advisory, so it just means the module is still being used - just with its vulnerability still there.
Comments
Comment #2
jan-e commentedWe also use Noggin for a couple of sites and would love to see it fixed. But I really would not know what to do more than following the described steps.
Comment #3
Bill Lea commentedIf there is a security issue with Noggin I have not been notified of it nor can I find a detailed description of the problem in the issue que. I use it on 4 sites. I am unable to find a replacement theme that gives a satisfactory visual design.
It's distressing to see that the security team is ignoring the problem and preventing community members from moving forward with assigning a new maintainer or to fix the problem. Distressing but not unexpected.
Could you point me at an explanation of the security problem? From the look of it, this issue is for the DEV branch. I'm not sure a development version problem should be allowed to kill the whole project.
I have running code but I will admit I had a struggle to find the correct version for MY sites.
I'd be glad to help fix it -- but I need to know just what the problem is.
Comment #4
jamesoakleyBill there's a reason why the issue is not announced. Announce it, someone can write the exploit.
So security issues are never disclosed until they're fixed, and even then you often just get given the patch not enough details to tell someone how to exploit an unpatched site.
They'd have contacted the maintainer, given reasonable time for a response, and then flagged it as unsupported. SA-CONTRIB-2019-080 is the result.
The correct way out of it is, as per the link in my op, for someone to contact the security team. If that person is serious about resolving the issue and taking over maintainership, then and only then will they disclose the vulnerability and offer their support to ensure it's fixed. So I emailed 3 and a half weeks ago, as directed, but I've had no reply. So I don't know what else to do.
Comment #5
greggles@JamesOakley I see in the original post you mentioned contacting the team. Sorry if you never got a reply on that. I think there was a big number of inquiries that week and some were overlooked. If you want to become a co-maintainer of the module please be sure to follow the process for that.
Now that 2 months have passed since this was unsupported our policy is that it can be published, so here are the details:
----original report-------:
This module has a XSS vulnerability.
You can see this vulnerability by:
1. Enabling the module
2. As a user with the Administer themes (administer themes) permission go to the theme configuration form (/admin/appearance/settings/bartik)
3. Enter the following values and save the form:
CSS header selector
</style><script>alert('XSS Selector');</script>Background color
<script>alert('XSS Background color');</script>Header height
<script>alert('XSS Header height');</script>Additional CSS attributes
<script>alert('XSS Attributes');</script>4. Open the homepage. Multiple alerts will be displayed.
Comment #6
jamesoakleyThanks, Greggles - appreciate all that the security team do. I can see how easy it must be for individual emails to get missed.
Here's a patch that fixes the 4 you pointed out. I've looked through, and all other user-settable variables are drop-down / radio choices rather than allowing the entry of free text. The exception is the image filename, but that has validation in place at entry time. So I think with this patch the issue is resolved.
With regards offering to take over maintaining the module: I've opened #3118555: Offering to maintain Noggin and #3118555: Offering to maintain Noggin in the issue queues for Noggin and Project Ownership respectively.
Comment #7
jamesoakleyIt would help the process if I actually attached my patch. ;-)
Comment #8
gregglesFor the selector does check_plain make more sense or would something like drupal_clean_css_identifier https://api.drupal.org/api/drupal/includes%21common.inc/function/drupal_... make more sense?
check_plain blocks xss in some cases, whereas drupal_clean_css_identifier ensures it's a valid css identifier AND protects against XSS.
Comment #9
jamesoakleyThanks for the feedback. I agree it makes sense to further ensure that the values entered remain useful, in addition to ensuring there's no XSS risk. I'm not quite sure if drupal_clean_css_identifier is the optimal way to do this for the height and background color settings, but it does no harm relative to check_plain. I certainly agree with you that drupal_clean_css_identifier is the better function for the additional attributes and the header selector. Thanks for pointing me in a better direction. :-)
A revised patch is attached
Comment #10
mcdruid commentedI think the patch looks pretty good.
I have one slight reservation: @JamesOakley said in #6
It's true that if a Custom image is to be used, the value for
header_pathis validated on form submit:However, as the comment suggests, _system_theme_settings_validate_path() is really just checking if a file exists at the path given.
It's possible to create files with dangerous names (depending on OS and filesystem etc..). For example:
...and that file path passes the existing validation.
AFAICS the functionality for supplying a custom image path is actually broken, so this doesn't lead to an exploit :) I couldn't get it to work with a path to an innocent image. I think there may be an issue with the position of the logic to handle
header_pathinnoggin_theme_settings_submit()such that thenoggin:header_pathvariable doesn't get set if you select "Custom image" and enter a path (without uploading a file). I could be wrong on that though.Long story short; it looks to me like that user-submitted value should probably be sanitised as well (e.g. in case that functionality is subsequently fixed).
Comment #11
jamesoakleyOK, I tried to set up a test case that reproduces the additional issue mcdruid describes, so that I can then check again to make sure my fix does fix.
The good news: I don't think this is actually a problem. The way the module works, it passes the URL for the image through file_create_url, which means everything gets escaped out. In the example mcdruid gave, I tried setting the URL for the custom header to
"files/'<script>alert(123)'"(having made sure there was a file present with that name). The result inline CSS tries to set the background url to /files/%27%3Cscript%3Ealert%28123%29%27. So I cannot produce a test case where such an apparently insecurely named file actually could do any harm - everything is URL escaped.The bad news: This is still "needs work". The original patch I submitted, whilst no longer making this insecure, also stops the module from working correctly. I'll be back.
Comment #12
jamesoakleyI've now fixed this issue.
The attached patch is the one to use.
Picking up on comments from earlier up this issue.
1. @greggles suggested in comment #8 that
drupal_clean_css_identifieris the sanitising function to use, rather than simplycheck_plain. Accordingly, I did that (#9). That broke the module, however, because (for some reason - I can't see why)drupal_clean_css_identifierstrips out the '#' symbol, which means you can't identify the header region by its id. Therefore I reverted tocheck_plainfornoggin:header_selector, and the module works again.2. @mcdruid suggested that a maliciously named custom image file could exist (and so pass settings form validation), and yet execute arbitrary code. I've checked this (see my comments in #11), and there is no danger here. The output is already being suitably sanitised.
With the attached patch applied, I've tried all 4 settings given by @greggles in #5, and none of them trigger a javascript alert function.
There is one issue I would need to address before a new version of this module can be released incorporating the security fix. Commit 2dc18b6f included several changes, one of which breaks the module in the live site I use this on. So I cannot simply apply this patch to the head of the 7.x-1.x branch, because that would release that breaking change.
Probably the cleanest way is to revert back to the commit before this (which is the one tagged 7.x-1.1), and reroll this patch to apply to that. I'd create a security release 7.x-1.2 that just fixes this one issue, then reapply the 4 commits since 7.x-1.1, and finally fix the problem introduced at 2dc18b6f so that the -dev release once again works on my site (and any others broken by that change).
However let's first work out if the security team are happy that this patch fixes the vulnerability, and go from there.
Comment #13
Bill Lea commentedSo did everyone just forget about this item?
It is continually giving me warnings AND TRYING TO GET ME TO UPDATE MY FILES. But there exists NO known alternative. Looking at this issue I can't see it as significant as you need administer privileges to change the theme. If you have administer privileges you can easily destroy he site. You font need complicated exploits to to that. So I can't see this as a real issue.
As I understand matters a patch has been developed and submitter for review and the SECURITY TEAM IS REFUSING TO REVIEW IT ? I mean a month passing buy and NO action? I could accept a couple of weeks but a month? Good grief! It has not even been addigned to anyone for review...
I may have to just rename the module to stop the errobious error messages flooding my mail box. I get so many I can't tell the real ones from the bogus ones.
Comment #14
greggles@Bill Lea did you review the patch?
Comment #15
gisleThe patch is public (comment #9), and reviewed by mcdruid and set back to "needs work" (comment #10). JamesOakley responded to the review by disagreeing about it needing work ("I don't think this is actually a problem.") and setting it back to "needs review" (comments #11 & #12).
I haven't made a stab at reviewing it myself, as such a review would not be of much value. I am not a member of the security team, and does not necessarily have the qualifications to review such a complex security issue.
I may be wrong, but to me, it looks like the security team is still waiting for JamesOakley to provide a new patch addressing the concerns expressed in comment #10, while JamesOakley is still waiting for the security team to conduct a new review of the patch in comment #9, taking into account his objections to the previous review.
But that is just me speculating. I think it would be nice if both the security team and JamesOakley could state explicitly what they think is blocking this from proceeding, and what they think can be done to resolve it.
Comment #16
jamesoakley@Bill - as greggles says, please feel free to verify that the patch in #12 does (or does not) fix the security vulnerability. See comment #5 in this issue for clear steps on how to reproduce the vulnerability, and then repeat with the patch applied to check the problem is solved.
@gisle - thank you. The order so far has been
I submit a patch in #7
Greggles suggests (#8) that drupal_clean_css_identifier is more suited than check_plain
I submit a fresh patch, using drupal_clean_css_identifier, in #9. I set to "needs review".
In #10, mcdruid suggests an additional vulnerability, whereby filenames are only checked to ensure they exist, but the filename could still be maliciously crafted to inject script into the page. Sets to "needs work".
I investigate this, and discover that the filename is sanitised at output time, so this is not actually an issue. Specifically, the malicious filename mcdruid used as an example is fully escaped and doesn't execute any script (#11). However, I also find that the module does not work as designed with my patch applied, so I leave it at "needs work".
Having found out why the module does not work as designed, I find two problems. Firstly, since the last tagged release, changes have been committed that break functionality. Second, there is one place where drupal_clean_css_identifier was wrong. So, in #12, I submit a fresh patch. Compared to the patch in #9, it reverts drupal_clean_css_identifier back to check_plain where that was causing a problem. I set back to "needs review".
So we're back to "needs review", but we've moved on from the patch in #9. We have a patch in #12 that fixes the security flaw detailed in #5, that uses drupal_clean_css_identifier where appropriate, and I've established that the possible vulnerability found by mcdruid is not actually a problem either in the module as it stands or in the patched version.
So I'm asking for #12 to be reviewed. That still leaves the breaking changes in the -dev release to fix, but my priority is to address the vulnerability. So if #12 fixes things, I'd roll back to before 2dc18b6f, apply the patch manually (or submit a re-rolled patch for fresh review if that's required), tag a new release that is the same as 7.x-1.1 but secure, and then reapply the commits since 7.x-1.1 to give me a secure base to fix the bug introduced since then.
Comment #17
gisleJamesOakley,
you're right, the one to review is in #12. My apologies for overlooking that.
Here is my two cents worth. Quoting from #16:
While this is true, this is IMHO not a recommended security practice. The recommended practice, AFAIK, it to always leave input as-is, and in the case of an XSS vulnerability: sanitize the output.
I leave it to the security team to make the call on this (so I am not pushing it back to "needs work"), but my recommendation would be to rework the patch and make sure that filename from untrusted input is stored as-is, and then ensure that the output is sanitized.
Comment #18
jamesoakleySorry, #11 was unclear in that case.
The filename is stored "as-is".
The module passes it through
file_create_urlat output time.Comment #19
gisleActually, my bad – it says "output". Second gaffe this morning.
Note to self: Coffee before typing anything.
Comment #20
Bill Lea commentedGentlemen:
I have used NOGGIN for many years with NO Problem.
No I have not run the tests suggested because IMHO the security problem is moot. I believe this because not everyone should have access to the theme layer of a site. It should only be available to a trusted role or to a system admin. Neither of these folks should be willing to destroy their own site. In the case of a large firm the IT department should remove access to a disgruntled employee before firing. The whole thing is moot.
I also believe that a site admin should have the ability of override the security team when they overstep their mandate and propose a moot flaw. I ma a cem engineer and all our alarm system have an acknowledge button to turn off alarms while they are dealt with. Even in cases where failure to deal with the alarm will destroy equipment and potentially kill people. Drupal should have the same sort of provision.
The problem with NOGGIN that is REAL is that it will not properly respect the aspect ratio of the header image. In the full scale Image I use the header needs to be 390px. I have e to set this and It is fixed even when the width is reduced to the iPhone width. I haven't dealt with this because I really don't care to try and show my images of such a small screen.
I note also that it's been said that the file path to the headers is broken. But I haven't verified this. I can select from any number of header images as long as they are in the right file folder. I'll see if this is a real problem but I don't think it is a thing affecting the version I am running.
I have found that some versions of NOGGIN which were published did not work and I have gone to the trouble of using an old version that does work - AT LEAST FOR ME. I note that this version is no longer listed on the noggin page under versions and I am not sure why it was removed. I only know that newer versions did not work with Pixturereloded theme and I settled on the one tat provided some functionality.
I was going to wait till you finished fiddling with the module to test it. But maybe I should compare my current version with your current version with its patch. Bur I will probably only look for fixes to the aspect ratio problem and the "broken file path" problem.
Even with all his work Mr Oakley is still not acknowledged as a maintainer and the module is still listed as abandoned and unavailable for download. At least on my sites status report. I will have to check on the noggin page if it still exists.
My appologies if I seem crankey or upset but how long can this take?
Comment #21
Bill Lea commentedI went into the code today and I believe I have fixed the problem with the file path not being recognized. It was never saved as a variable.
So I suppose it needs some sort of sanitation.
I have not yet looked at the sanitation in detail. Its next on my agenda. You should note that I am using the code 7.x-1.1+4-dev dated datestamp = "1487558592".
. All the image functions are now working. I will look into the patches proposed by Mr Oakley later tonight. I'm hazy on making patches so I am attaching the entire revised module file if any one is interested in a work in progress.
My plan at the moment is to apply Mr Oakley's proposed patches by hand and then see if the code still runs.
Comment #22
Bill Lea commentedDrat forgot to attqach the file.
Comment #23
Bill Lea commentedso there is is a problem that has not been addressed heretofore in this discussion. There are TWO branches fof the nogin module. The main brance and the dev branch. jef Burns stated that only the dev branch will work with his theme pixturereloaded and that other users should continue to use the main branch. I use jeff's theme pixturereloaded. Thus I am working with the dev code. Mr Oakley's patch fails when run against the dev branch. Of course I just may be doing it wrong. As I said I am hazy about patching. It's made more difficult since the GIT repository does not contain a dev branch so I'm not sure howto create one correctly. I have all the files. reading the patch file does not really enlighten me as to the changes needed. As I said before, the module file I uploaded is fully functional on my system with the exception of the xxs changes. It will probably need its own separate patch and there will also need to be TWO versions of the noggin module maintained if the min branch is indeed incomparable with pixturereloaded and the dev is indeed incomparable with other themes. it should be noted that I am taking jeff's word on this incompatibility I have not tested it by trying to run the main branch under my site. I may look at that later in the week.
Comment #24
jamesoakleyBill, thanks for engaging with this one
There is one branch of Noggin (called 7.x-1.x).
On that, releases get tagged. The most recent is 7.x-1.1. This is the one people should be using on live sites.
Since releasing 7.x-1.1, some further changes have been committed to the git repository. Drupal automatically keeps a development release built (called 7.x-1.x-dev), which can be downloaded as the dev release (not branch). This allows someone to use the version containing all the latest changes. This can help with testing and development, but is also risky because the maintainer may deliberately not have tagged a new release until the latest changes are stable.
Jeff has added some code since 7.x-1.1, which means 7.x-1.x-dev is ahead of 7.x-1.1.
My patch will apply cleanly to 7.x-1.x-dev.
However, one of those changes (since 7.x-1.1) breaks the functionality of the module. (I have identified which change. I hadn't realised this is dependent on which module uses Noggin. But we need to get the security issue addressed first before fixing it.)
So, the steps to proceed are as follows.
To apply the patch, you probably need to run
patch -p1 < {path to patch file}from the module directory once you have downloaded 7.x-1.x-dev cleanly, but helping troubleshoot that goes beyond the chat in this issue thread.Comment #25
Bill Lea commentedI have been looking at the downloadable release and the dev release. The dev release works well with the pixture reloaded theme while the 7.1.1 release does not. They appear to be quite different sets of code. I have found the problem with the path not working. it needs to be saved in the dev code. I haven't found that to be the case in the 7.1.1 code.
What theme are you running? Is it availiable freely so that I could test it?
My struggles with GIT are probably outside the scope of this chat but it makes if difficult for me to patch things. I can not reliably apply a patch nor generate one. I will try your suggestion. I put the patch in the repository and used the v option. The patch failed when I tried to run it. I will re-clone and try again.
Today I examined the behavior of the two versions. I tested the theme performance against Bartek and Garland the dev seemed to work although the results were visually distressing to me. The menu appeared in the center of the header image.
I will tyr patching it again both the 7.1.1 and the dev and see what the result is. As far as I can tell I have fixed the path problem with the dev version - they simply forgot to save it. I will also look and see if I can figure out what you did to the release and do likewise to the dev version.
Thanks for the prompt reply.
Comment #26
Bill Lea commentedJames:
I have successfully applied your patch 12 to the module. I tested it with the four given criterion and it appears to pass. At least no warning or alert messages appear. My earlier problems were due to the fact that I had cloned the wrong code and was trying to apply patch 9. Sorry.
I do flail about when I do this, which is one reason I don't often engage in maintenance activities.
In the matter of the path not working I found that it was not being saved. I added a variable_set statement and that problem goes away. I am not so sure the logic of the data input is clear. If you have a entry in the path you can still upload an image and the file path is not cleared. If the file path is cleared and no file is uploaded a blank header background is displayed. This is just annoying behavior and will not stop the program from being usable.
I am attaching a patch with my fix to the header path problem for your review. I guess that is appropriate.
I first applied your patch 12 and then fixed the path problem. It's a simple fix. Can't speak as to the other problems.
What I can not understand is the length of time it's taking the Drupal guys to approve you as the maintainer of this module. It's excessive even for a volunteer organization.
Comment #27
jamesoakleyBill, thanks for persevering with this, and with the patching stuff in particular which I can see doesn't come naturally.
If patch 12 fixes the vulnerability identified by the Security Team, could you please change the status of this issue to "Reviewed and Tested by Community". (As it's my patch, I shouldn't be the one to do that). That means it's ready to be committed, which is one thing the security team will have been wanting to see before granting me maintainership (in the absence of them having time to test the patch themselves).
The issue with the path not working / being saved: Could you open a separate issue to discuss this. It helps to keep module issues in separate Drupal issues, as a general rule. That's especially so here, when we don't want other bugs to complicate the security issue which is what's holding up the whole module.
(You asked what theme I use this with. I use a subtheme of Pixture Reloaded, and the only thing I've done in subtheming it is added a load of custom CSS to make things have the colours / fonts / etc. that I want, and to set up the layout of elements within the content of particular pages. My theme will interact with this module in exactly the same way that unaltered Pixture Reloaded does).
Comment #28
mcdruid commentedThank you for your perseverance everyone.
@JamesOakley re. #11 and #12 yes, I think you're correct that in most cases the value of a custom header image will be escaped / encoded by
file_create_url().You can manipulate your way around that somewhat, but probably not in a way that opens up an obvious exploit.
For example (this is with noggin 7.x-1.x as it currently stands, and a clean vanilla install of D7.77):
As mentioned, there are a couple of reasons why this may not be a big problem; first if there's validation elsewhere that the header_path variable matches an existing file, prepending the path with a slash will likely make that fail (I've not tested this though).
Also, by default the inline CSS here is output as CDATA e.g.:
So that particular value (probably) won't result in the browser running the JS.
There may be other ways to get this to work though; I do still wonder whether the value should be directly run through something like
filter_xss()for good measure.Comment #29
Bill Lea commentedOK. AFAIK the patches work and produce no alerts.
I was not familiar with the coordination procedure so I will make the update.
I am confused by Mcdruid's last post. I do not use DRUSH for anything therefore I am not sure what he is doing. All my testing iis done thru the theme management input forms.
My test site does not contain any customization other than a change I made to file_field_paths so it would run with my ZIFIMAGE module. Actually I do not have ZIFIMAGE switched on at this time. I can't see how my site configuration would be a factor. I run pixture_reloaded in a vanilla state. I have looked at other themes and and as stated in the Noggin readme they do not seem to support the header height spec. Garland, Bartik, and Best_Responsive do not respect the header height value. This puts the menus in the interior of the header image .
I can't get past the requirement to have theme level access permission to access these forms. I believe that is protection enough. Is DRUSH applicable of bypassing the security system? Theme level access is not something you would give to just anyone. Indeed, to use some aspects you would need SSH/FTP access to thew HOST file system. If you have THAT you can install any malware you want and no sanitation will be effective.
Comment #30
jamesoakleyBill - you can leave this with me. I've now got maintainer access to the module, and I'll fix the security flaw. (I'll need the Security Team to sign off on that before the module no longer shows as "unsupported"). It probably won't be until after Christmas now - a busy time of year for me - but I now have the tools to get this moving.
As for your question, you don't use Drush, but others do. What McDruid has spotted is that in certain cases Drush (a tool for managing Drupal sites on the command line) exposes the unsanitised filename of the header image. That would be much much harder to exploit maliciously than the unsanitised filename being passed to the browser (which doesn't happen), but theoretically. ... When security vulnerabilities are found in a Drupal module, the Security Team assign the vulnerability a score of how serious it is. That score is made up of many factors, such as how hard it is to exploit, the permissions needed before you can exploit, and the amount of damage that could be done. Something that requires "administer themes" permission, and can only be exploited via Drush, would be a very low scored vulnerability.
Anyway - leave it with me.
And please open a new issue with any other problems you may have.
Comment #31
gisleJamesOakley,
if somebody untrusted has access to the CLI (including drush), they've got all the keys to the kingdom. You cannot defend against that. You just have to make sure nobody you don't trust can access the CLI.
However, what I believe McDruid is doing here is to use drush as a shortcut to get the exploit into the database. Whether this is doable without the use of drush is moot. To determine that one way or another would require tons of static code analysis and white box testing – probably a lot more work than anybody here would be able to commit to.
Instead, goes the reasoning: Let us just assume that somebody discovers a way to get the exploit into the database. Is the code still secure? Thinking like that, and then finding a way to make the project secure even if an exploit exists in the database, is basically good housekeeping. I think you should go along with that type of reasoning, rather than speculating about whether getting the exploit into the database is a possibility.
Comment #32
jamesoakleyIf that's all McDruid was probing with Drush, then there's nothing to worry about.
As I demonstrated above, sanitising the header image URL happens (as it should) at output time, as the HTML is assembled, and not at input time. So the fact that Drush could be used to insert a raw image URL into the database still does not mean that anything unsafe would be sent to the browser. Unless I've missed something,
file_create_urltakes care of that.Comment #33
gisleThe way I read his comment #28, he says that the preprocess funcition (
noggin_preprocess_page()) will produce an unescapedbackground:url('/<script>alert(123)');. He then concludes that while this probably cannot be exploited – but …My interpretation of that statement is that he thinks that we cannot be 100% certain that
file_create_url()will provide the necessary sanitaszion in all possible use cases where this data may be output. While usingfilter_xss()to explicitly sanitize this data may be unecessary, as we do not have the imagination to foresee how the project will be used, including its use by other site builders. Therefore, providing an extra layer of security to safeguard the data is recommended.Comment #34
mcdruid commentedIn #33 @gisle's interpretation of the point I was trying to make is spot on.
Forget about drush; I was just using it as a quick way to set a D7 site up for testing; you could achieve almost all of the same things by clicking around in the UI, but enumerating / following every step of that process is more onerous than using a couple of drush commands.
Yup, exactly; if an attacker can get a malicious value into the
noggin:header_pathvariable, and the value begins with a slash thenfile_create_url()will not escape / encode that value and it will be output without any sanitisation.You might say that's not likely to happen, and that's probably correct. IIRC there's validation in the admin UI which checks that header_path with
file_exists()so perhaps that wouldn't allow values beginning with a slash. However, there's no guarantee that functionality won't be removed / altered during subsequent development of the module or by custom theming / coding on a site etc.. Does it work exactly the same way on Windows servers?Perhaps it seems unlikely to the point of being implausible that this could ever be exploited, but there's that saying when it comes to security that "the attacker only has to win once".
@JamesOakley is right that
file_create_url()will almost certainly encode this value such that it's safe, but I don't think that's guaranteed to be always be the case in every conceivable circumstance.Hence why I think we may as well run the value through a sanitisation function which is designed for that specific purpose and is guaranteed to produce predictably safe results. Doing so ought to add very little cost, and should provide assurance that this functionality cannot be abused.
Comment #35
mcdruid commentedOh, sorry - I didn't intentionally change the status, but I suppose it's appropriate for me to "un-RTBC" given the comment.
Comment #36
jamesoakleyUnderstand - I hadn't looked into this properly yet, and I'd missed the leading slash issue.
OK, so
filter_xssit is then: No harm done, and could potentially head off an unforeseen exploit.Does it do everything
file_create_urldoes, such that that becomes unnecessary, or do we need to chain both functions?Comment #37
mcdruid commentedPretty sure you'd need
file_create_url()plus a sanitisation function.Comment #40
mcdruid commentedThanks for your patience.
@JamesOakley pinged me to say he's prepared a 7.x-1.2 tag.
I've reviewed that and am happy that it fixes the reported XSS issue that led to this project being marked as unsupported.
I'm making this issue as Fixed, and we should then be able to get the module restored to security coverage with a new release.
Comment #41
Bill Lea commentedI applied the revised Noggin module to my test site today. It no longer works. Noggin will no longer recognition the uploaded files in the header-files folder. You can see them select them but It will not let you USE them. The module is for all intents and purposes UNUSABLE in its present t state. I don't know What you did to the file naming process but it appears to have BROKEN it. Please fix it properly.
Comment #42
jamesoakleyThanks for the feedback, Bill.
Did 7.x-1.1 work in a way that 7.x-1.2 does not?
Comment #43
Bill Lea commentedI am continuing to test the modified noggin code. I have reverted to a known working code version and have located one problem.
when you attempt to sanitize the color attribute one of the valid color inputs is #FFFFFF this is rendered as FFFFFF which seems to break the system.
I will continue to try and add your sanitation functions to my working code one by one till I see if anything else breaks the code. I will also see if removing the sanitation from your code will fix the system.
I note in passing that it appears the path is not saved and thus will remain broken in this code. Also I am working full time on this because I want to get to the bottom on it and I do have the time. I will keep you posted on my results
Comment #44
jamesoakleyThanks, Bill - appreciate your persistence and work on this.
There are two things we need to do. Firstly, the initial aim was to get 7.x-1.1 turned into a released version that wasn't vulnerable to XSS attack. That means there will be functionality that 7.x-1.1 hadn't got right that the new release will also not get right. It sounds like (#FFFFFF) there is work to do to improve on 7.x-1.2 in this regard. Then, second, the module had moved forwards since 7.x-1.1. On my site, 7.x-1.x-dev didn't work at all. So those changes fixed some issues (probably including some of the ones you'd been having), but introduced fresh ones. So having reached a stable 7.x-1.2 / 7.x-1.3 (which simply secures 7.x-1.1), we then put back the changes that have been temporarily reverted but in a form where they're fixed and don't have regressions.
Comment #45
jamesoakleyI've found the problem with the background colour, and fixed it. 7.x-1.3 is the result.
I'll document what I did here, as it relates to fixing the vulnerability. I originally proposed (#7) using
check_plainto sanitise all the input variables. @greggles suggested thatdrupal_clean_css_identifiermight be a more robust alternative (#8).I broadly agree. I discovered that the CSS Selector field broke if we used
drupal_clean_css_identifierbecause it stripped out '#' signs if we identified the header by an element ID (rather than a class). So reverted tocheck_plainfor the CSS Selector.You'd discovered what I'd missed: If someone uses the hex code for a background colour (rather than a CSS named colour), the same problem occurs. So I've simply set the background colour also to use
check_plain.@Bill Lea - please let me know here if you find any other problems in 7.x-1.3 that are regressions from 7.x-1.1 (as opposed to things that didn't work properly in 7.x-1.1, and that need fixing now as much as they did in 7.x-1.1). Thanks again! :-)
Comment #46
Bill Lea commentedThe software continues to jumble my site. I use a large image so I need to be able to set the header height to say '426px'' the current code
somehow doe not respect this height. That is the header is expanded and but it is then overlayed by the menus content and sidebars.
It's just a big jumble.
Do you intend to fix the path problem, or just delete that functionality?
Comment #47
jamesoakleyStep 1: I want to get a version that has all the features and bugs of 7.x-1.1, but without the security vulnerability.
Step 2: I intend to put back the changes that I reverted to get us back to 7.x-1.1 (so that we could then release a fixed version of that).
Step 3: I then intend to check if the problems that those changes were designed to fix are indeed fixed, or if further work is needed. I need to check also if those later changes introduced any fresh bugs that were not present in 7.x-1.1 Once the problems supposedly fixed by 7.x-1.x-dev (prior to the security advisory) are actually fixed, without any regressions, I'd release another tagged release to give sites access to those fixes without having to use a development release.
Step 4: Take stock of what other problems and bugs have not yet been picked up at all, and work to squash those.
So, what I need clarity on at the moment is this: The height jumbling problem you're experiencing - is this a new problem in 7.x-1.3, where things worked fine in 7.x-1.1? Or do you experience the same problem if you go back to using 7.x-1.1?
I'm waiting to move on putting the other changes back (Step 2, above) until I know that 7,.x-1.3 did not introduce any fresh bugs not present in 7.x-1.1.
Comment #48
Bill Lea commentedThanks for your reply. It is a pleasure to work with a maintainer who responds so quickly and thoroughly.
Your proposed scheme is fine with me.
You should know, however, that I have what is now a forked version of noiggin running on my sites. I picked up most of the changes you made and fixed the path problem. It works but is probably much different from your code. If you wish Ill send you a copy or put it up on github. All of my thinking on noggin is blogged on williamglea.com. At the current time I am considering whether or not it is worth the effort to fix the image management file system. My thoughts about that are blogged on williamglea.com as well. No need to spam the site here
I recently tried 7.1.3 and it to does not respect the header height specification. I have no idea why. Sinbce I have working code I have not spent the time needed to debug it. I'm going to be distracted for thte next few weeks so I might be slow to respond.
But I'd line to express my appreciation for your efforts on behalf of the NOGGIN users.
Comment #49
jamesoakleyThanks - it would be good to get Noggin working correctly as advertised for all users. Currently, the project page shows 1,342 people using the module. So I'll message you directly to have a look at your fork, as the best of what you've done to fix bugs could usefully be merged back in here.
Back to the issue in hand: 7.1.3 seems to me to set the height CSS property correctly. I can see the height property set to the header element in Chrome Inspector. However, in the case of Pixture Reloaded (for example), I have the CSS selector for Noggin set to
#header .header-inner. The HTML is structured so that a div with class .header-inner sits inside a header element with id #header. That inner div is correctly set to the height I use. However the CSS for Pixture Reloaded sets max-height to 88px for #header, which means that the inner div can't expand bigger than its parent.So you'd need to add
header#header { max-height: none; }to your theme's styling to override that.I'm going to conclude then that 7.1.3 introduced no bugs other than ones already present in 7.1.1, and work to put the other changes (that endeavoured to fix some of them) back.
Comment #50
jamesoakleyComment #51
gisleJamesOakley,
please don't change the status of an issue from "Fixed" to "Closed (fixed)".
An issue with the status "Fixed" will be automatically closed as fixed and removed from the list of open issues after 14 days. It should remain open for 14 days after being "Fixed" to cater for regressions and other unintended consequences of the fix. Source: Issue Status Field.
In general, as a project maintainer here, you may want learn about Issue Etiquette.
Comment #52
jamesoakley@gisle. Thanks
Comment #53
Bill Lea commentedSigh:
I think you are wrong.
The 7.x-1.0 branch has been known not to work with pixture reloaded since 2017. I have had NO problems with it that would require me to fiddle with the theme code.
Here is a patch based on the DEV branch that in the words of Ted Howard "Just works".
Pleas check it out.
I known not what course others may take but I will use this code.
Comment #54
jamesoakleyThank you.
I will look at that for comparison to see how to work around the limits imposed by an outer wrapper element.
Did 7.x-1.1 "just work"
We need to work out whether the problem crept in between 7.x-1.0 and 7.x-1.1, or between 7.x-1.1 and 7.x-1.3.
Please simply answer that question.
If the latter (7.x-1.1 worked but 7.x-1.3 does not), then it's a regression caused by fixing this xss flaw. It then needs discussing here, as it's part of this issue.
If the former (7.x-1.0 worked but 7.x-1.1 did not), then it's a distinct issue. Please in that case open a fresh issue so that this one can be kept for the xss flaw. The issue queue gets much harder to use if issues start discussing other unrelated bugs and problems from the one they were created to tackle.
So over to you please: which tagged release was the first one not to display over height images correctly?