Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 3789388
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 19, 20262026-05-19T12:08:58+00:00 2026-05-19T12:08:58+00:00

I would like to be sure, that I didn’t use $_POST or $_GET in

  • 0

I would like to be sure, that I didn’t use $_POST or $_GET in a way an attacker could make use of (XSS-Attacks, SQL-Injections). To find all lines where I used $_GET or $_POST I used this command:

egrep "_GET|_POST" -r -i MyFolder > dangerousUse.txt

dangerousUse.txt has 439 lines. If I search like this:

egrep "\$_GET|\$_POST" -r -i MyFolder > dangerousUse.txt

dangerousUse.txt has 0 lines. If I search like this:

egrep "_GET\[|_POST\[" -r -i MyFolder > dangerousUse.txt

dangerousUse.txt has 385 lines. I think this is the number I want, but I would like the $-sign to get matched, too.

My first question is: Why doesn’t the second egrep-command work?

Now I am sure, that the input is used correct if one of the following commands have been applied:

  • mysql_real_escape_string(htmlspecialchars($input)) or mysql_real_escape_string ( htmlspecialchars ( $input ) ) or other combinations with whitespaces.
  • intval($input)
  • isset($input)
  • $input == or == $input

How can I find only those lines, where $_POST or $_GET are used without these functions? It would also be okay to delete the lines in dangerousUse.txt, where these functions are applied to each $_POST or $_GET in this line.

edit:

egrep '\$_GET\[|\$_POST\[' -r -i MyFolder > dangerousUse.txt

works, thanks to VGE for the first part of the answer. Now dangerousUse.txt has 385 lines. But the second one is more important for me.

for the second part, egrep -v inverts matches:

egrep '(isset|intval|mysql_real_escape_string\(htmlspecialchars|md5|datum_anpassen)[\w]*\(\$_' -i -v dangerousUse.txt > dangerousUse2.txt
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-19T12:08:59+00:00Added an answer on May 19, 2026 at 12:08 pm

    Shell double-quotes requires a double escaping.

    Exemple echo "\$" will print ‘$’
    But echo "\\$" will print ‘\$’

    And ‘$’ is the end of line regex marker and is the shell variable prefix.
    The following patterns will work fines

    egrep "\\\$_GET|\\\$_POST" -r -i MyFolder > dangerousUse.txt
    egrep "[$]_GET|[$]_POST" -r -i MyFolder > dangerousUse.txt
    egrep '\$_GET|\$_POST' -r -i MyFolder > dangerousUse.txt
    

    The latest is the simpler because shell does not perform variable interpolation inside single-quote and there is no escaping.

    Probably one method to insure that you check all you input is to define a sanitized_GET and a sanitized_POST function which perform all the stuff.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I would like to make sure that an applescript can be converted to bash.
I would like to make sure if a textbox has any content at all,
I would like to use standard icons in treeview but I am not sure
In my stored procedure, I would like to check to make sure what I
Would like to make anapplication in Java that will not automatically parse parameters used
I'm not sure how difficult this but I have an array and would like
I am pretty sure I cannot, but I would just like to double check
I really would like to use the getBuffer:length: method of an NSInputStream. After a
I have table that has a column of type DateTime, I would like to
I was reading something a few months ago that would take something like: SELECT

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.