I noticed a problem with the fckeditor , when copying text from a website.
It seems that the fckeditor just uses the internal html of the copied page .
However , when there are scripts between the text being copied , this is also directly copied to the editor.
When the data is then saved , and retrieved , this breaks the editor , and allows for the execution of those scripts.
A malicious user could abuse this to execute his own scripts, like breaking the editor , redirecting the page to a fake page , etc ...
It seems that the fckeditor just uses the internal html of the copied page .
However , when there are scripts between the text being copied , this is also directly copied to the editor.
When the data is then saved , and retrieved , this breaks the editor , and allows for the execution of those scripts.
A malicious user could abuse this to execute his own scripts, like breaking the editor , redirecting the page to a fake page , etc ...
Re: BIG SECURITY HOLE in fckeditor
that's a BIG SECURITY HOLE in your application.
A malicious user won't waste his time inserting the data into the editor, instead he will post it directly bypassing any client-side checks, so if you just accept any data that it's sent and then use it without performing any sanity check then you're toast.
Implement a filter at your server side ASAP.
Re: BIG SECURITY HOLE in fckeditor
That is correct . However , how many people have applied these filters , as most are unaware of it .
Also , applying a script is not that simply at server side , as it tends to remove more data then it should .
Injecting it directly via post data is indeed possible , but it does require more knowlegde . All you have to do with the problem here is create a script inside html , run the file , than copy everything and paste it inside the editor , and you're done .
Rest assured , the server side solution is being worked on , but it would be best to cover all angles , and provide a security at client side as well .
Thx for the reply
Re: BIG SECURITY HOLE in fckeditor
You can search for previous threads about this kind of issues or google about them, I think that HTMLPurifier was one of the scripts that takes care of them.
You must remember that it's quite easy to do a proper cleanup as the output of FCKeditor is a valid XML tree, you you can easily manipulate and remove any attributes/nodes that you don't want and then recreate a new string that it is safe. You don't need to do anything at the client side.
Re: BIG SECURITY HOLE in fckeditor
I see your point. People might think client side security is enough , while it's indeed pretty useless , since it can be bypassed by injecting post data.
I just wonder how many people implement the fckeditor without being aware of it . Might be good to put it in the documentation , or if it is there , make it more visible. Or maybe put it in the FAQ's . This would also avoid that the question comes back to the forums.
Anyway , thx for the info , i'll look into it.
Re: BIG SECURITY HOLE in fckeditor
Re: BIG SECURITY HOLE in fckeditor
Re: BIG SECURITY HOLE in fckeditor
If fckeditor had the ability to filter html being pasted into its control such that it could filter out embedded code, then when the server received data -- from that control -- that had such embedded code, it would know that somebody circumvented the control (or that there is a bug in the control's filtering). In either case, the server would stop processing the request and log the incident.
Notice that in both scenarios above, the server does not "rely" on the control. But it can take advantage of the control's expected behavior to detect hackers. Because the fckeditor does not have any such filtering, servers using the control has one of two choices:
1. Assume that any embedded code in the html is coming from a hacker and stop processing, or
2. Filter out the embedded code and continue processing.
Going with choice 1 is unfriendly to the innocent user who unintentionally copied & pasted from a web page with embedded code. Going with choice 2 would allow a hacker to use trial and error to find a weakness in your server's filtering. Obviously, you can log requests that contain embedded code when using choice 2, but it takes time for IT to investigate any given incident and such an investigation isn't as straight forward when the IT person has to distinguish between "innocent" and "malicious" instances.
In our shop we will probably go with choice 1. If we see that we get a lot of server errors due to "innocent users," we will probably implement filtering in fckeditor to minimize such errors. Note that any such filtering in fckeditor will just be a bonus. We will never "rely" on it.
Re: BIG SECURITY HOLE in fckeditor
Some might want to disable all scripting. Other people might have other requirements, so the first task would be to define how to do a proper validation.
Then you have to apply that validation, I think that I would add it at the xml-> text serialization, but it might depend on the rules that you want to apply.
And for me, the problem if some simple javascript validation is added, is that too many people would think that it's enough. I've seen too many people that despite the warnings in the server connectors to apply some kind of session validation, they just leave them enabled for everyone because it's easier that way, so I won't trust them to use another extra code to prevent XSS attacks, they will think that the default one is good enough.
Anyway, you should go ahead, look at what you need, how it's done for example in the purifier mentioned previously and if you share your code other people might contribute to it.
Specially in the new CKEditor the core will be minimal, so almost everything is a plugin.