Take the 2-minute tour ×
Information Security Stack Exchange is a question and answer site for Information security professionals. It's 100% free, no registration required.

Code:

$result = "Hello World";
$jsonEncodeValue = $result;
echo $jsonEncodedValue;

Assumed Output:

"Hello World"

Real Output:

\n"Hello World"

This \n Line Feed added automatically.

For this extra Line Feed my result breaks down while parsing through JSON parser. I am trying several hours to solve the issues.

I have checked at

  • .htaccess is there any auto_prepend file exists which adds extra Line Feed, but not. I didn't get anything.
  • Cgi-bin file is there any malicious code exists that adds extra Line Feed, but not. Didn't get anything.

My Question:

  • Is someone injecting HTML or PHP code?
  • If then, how to detect from where code injection is running (is there any way to find out from which file code injection is running) and how to prevent?
share|improve this question

closed as off topic by AJ Henderson, Rory Alsop Feb 11 '13 at 15:46

Questions on Information Security Stack Exchange are expected to relate to Information security within the scope defined by the community. Consider editing the question or leaving comments for improvement if you believe the question can be reworded to fit within the scope. Read more about reopening questions here.If this question can be reworded to fit the rules in the help center, please edit the question.

    
Is this occurring when you put your input in? Have you verified the source against your local source repository? Based on how it is currently described, this sounds like it is most likely a programming error and is probably a better fit for stack overflow. –  AJ Henderson Feb 11 '13 at 14:01
    
@AJHenderson, While I am running this script in my localhost server, then running well. Even while running on Another Web Server then running well. But while running on our current dedicated server then at every script I am facing this problem. –  Md. Mahbubur R. Aaman Feb 11 '13 at 14:13

1 Answer 1

up vote 1 down vote accepted

it seems to me that you are facing more of an encoding issue rather than a security one. windows uses CRLF, unix uses LF, mac uses CR. encoding may affect these behaviors. is the dedicated server has the same configuration as the 2 other boxes? you may need to compare. also you may probably had the need to check your editor and the encoding of your source codes.

share|improve this answer
    
Yes. The Dedicated server has the same configuration as the 2 other boxes. Even two sub-domains reacts differently, i.e. subdomain1 reacts as assumed output and subdomain2 reacts as real output. –  Md. Mahbubur R. Aaman Feb 12 '13 at 3:32

Not the answer you're looking for? Browse other questions tagged or ask your own question.