Jump to content

Weird PHP/Apache Error - Posted value that contains "CD/" results to an error


Bandai

Recommended Posts

I'm getting this weird error when I try to send a certain string via POST to a PHP script hosted online.

 

This is the string I'm trying to send:

 

<b>character name cd</b>[/Code]

 
 
The string here that is causing the problem is the two letter "CD". Even if I sent it like this I'm still getting the "Not Acceptable" error.
 
[Code]<b>CD</b> [/Code]

 
 
or even this:
 
[Code]CD/[/Code]

 
 
But if I send it like this (any character after CD except space) it goes thru:
 
[Code]<b>CDa</b>[/Code]

 
 
What could be causing this error? My google-fu wasn't enough for this.
 
 
I'm testing this via simple HTML form and posting it to the PHP file that would output the value, here's the HTML code for the form:
 
[Code]<form action="http://linkhere.com/accept.php" method="POST" name="acceptme" enctype="multipart/form-data" accept-charset="UTF-8" >
    <p>Test:</p>
    <textarea id="testvalue" name="testvalue" rows="10" cols="50"></textarea><br />
    <INPUT type="submit" value="Submit" id="submit1" name="submit1">    
</form>[/Code]

 
The PHP is accepting it using
 
[code=php:0]file_get_contents("php://input");

 

Then just displaying the passed value.

 

Other info that might help find out the main cause of the problem:

* Shared hosting

* mod_security is disabled

* Nothing on the Apache error_log file

Link to comment
Share on other sites

Without seeing the code for the script that processes the data, there's no real way to tell what's going on. A cut and paste of the entire actual error message would probably also be helpful.

 

Here's the PHP code I'm using for testing and the error is happening with this as well:

 

<?php

$str = file_get_contents("php://input");

echo $str;

?>

 

Nothing special here really, any idea what is causing the problem?

Link to comment
Share on other sites

Sounds to me like the server is probably running mod_security or similar and has a filter setup to deny any requests containing CD followed by a /.  Possibly setup to try and prevent attacks involving sending shell commands.  You'll have to talk to the hosting company/server admin about it if that is the case.

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.