LiteSpeed Technologies
Download Download     Blog Blog     Wiki Wiki     Forum Forum     Store     Contact Contact    

Go Back   LiteSpeed Support Forums > External Applications > Java JSP/Servlet > 403 error for save <SCRIPT> into file on the server

Reply
 
Thread Tools Display Modes
  #1  
Old 06-04-2012, 04:25 PM
saeeded saeeded is offline
New Member
 
Join Date: Jun 2012
Posts: 2
Default 403 error for save <SCRIPT> into file on the server

hi and sorry for my English
i write an small application by PHP that read/write html/or/txt file by simple form.
.
its worked as well until server updated by litespeed protection method.
.
here it is my code ------> do.php
PHP Code:
<?php
// set file to read
$filename "xx.txt";
  
$newdata $_POST['newd'];

if (
$newdata != '') {

// open file 
$fw fopen($filename'w') or die('Could not open file!');
// write to file
// added stripslashes to $newdata
$fb fwrite($fw,stripslashes($newdata)) or die('Could not write to file');
// close file
fclose($fw);
}
 
?>
and by this form i get data to store into "xx.txt" file :

PHP Code:
<?php
$filename 
"xx.txt"
$fh fopen($filename"r") or die("Could not open file!");
$data fread($fhfilesize($filename)) or die("Could not read file!");
?>
<html>
<form action='do.php' method= 'post' >
<textarea name='newd' cols='100%' rows='50'><?php print $data ?> </textarea>
<input type='submit' value='Save Data'>
</form>
</html>
its will accept all character or html tags by this form and will stored into TXT file, but when i want to save <script> character alone or middle html tags, litespeed return error

403 Forbidden
" Access to this resource on the server is denied!"
Powered By LiteSpeed Web Server
....
.
this 403 error will not reported apache error logs.
how can i resolve this problem ?!

thanks for your attention.
Reply With Quote
  #2  
Old 06-04-2012, 07:16 PM
NiteWave NiteWave is offline
LiteSpeed Staff
 
Join Date: Sep 2009
Posts: 2,226
it may trigger certain "Request Filter" rule.

check
lsws admin console->Server->Request Filter, disable "XSS attack" rule if it's enabled.
Reply With Quote
  #3  
Old 06-05-2012, 01:56 AM
saeeded saeeded is offline
New Member
 
Join Date: Jun 2012
Posts: 2
thanks "Nite wave" for your reply
.
Im just a client on the server and can not access to the server configuration.
.
Litespeed does have .htaccess file (same as appache) to listen each folder by configured rule ?! (for security)
.
or can i resolve this issue by scripting ?
Reply With Quote
  #4  
Old 06-05-2012, 02:05 AM
NiteWave NiteWave is offline
LiteSpeed Staff
 
Join Date: Sep 2009
Posts: 2,226
may be not. try to ask your host to disable that rule.
if that rule already disabled, then maybe mod_security plugin for cPanel has been installed by your host, that acts same as request filter but more powerful and complex.
Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -7. The time now is 06:08 PM.



- Archive - Top
© Copyright 2003-2011 LiteSpeed Technologies, Inc. All rights reserved. Privacy Policy.