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

  • SEARCH
  • Home
  • 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 708787
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 14, 20262026-05-14T04:25:49+00:00 2026-05-14T04:25:49+00:00

Is the following SQL susceptible to SQL injection via the @SearchWord parameter? I want

  • 0

Is the following SQL susceptible to SQL injection via the @SearchWord parameter?

I want to use parameters with the FormsOf function, but the only guide to doing so I’ve found is in this Stack Overflow question: How to pass parameter to FormsOf function in sql server

However the solution seems to be to use a bit of dynamic SQL, and I was wondering if that would be susceptible to SQL injection. What would happen in the following example if @searchWord contained a SQL injection type string? Is it not a problem because it’s still within a parameter, passed as an argument to FREETEXTTABLE?

The solution given is:

DECLARE @SearchWord nvarchar(max)
SET @SearchWord = 'tax'

DECLARE @SearchString nvarchar(max)
SET @SearchString = 'FormsOf(INFLECTIONAL, "' + @SearchWord + '")'

SELECT listing_id, RANK, name, address, city, zip, heading, phone 
FROM listings a, 
FREETEXTTABLE(listings, *, @SearchString)
WHERE [KEY] = a.listing_id
ORDER BY RANK DESC, name
  • 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-14T04:25:49+00:00Added an answer on May 14, 2026 at 4:25 am

    No, it’s not susceptible. There’s no dynamic SQL here (that would require either using EXEC or sp_executesql), so there’s no vector for SQL injection.

    In order for a SQL injection vulnerability to exist, the user-supplied string (in this case @SearchWord) must actually be inserted directly into the text of the SQL statement. Here, it’s only being used to construct another string variable, which is subsequently used as a parameter to another SQL statement.

    This statement can, however, fail if the user inputs an “invalid” search word, i.e. one containing single quotes, so you should probably still escape whatever value is passed to @SearchWord. But it cannot be used to execute arbitrary SQL.

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

Sidebar

Related Questions

I have the following sql query and I want to filter the results where
I have to following SQL Statement that I want to conver to LINQ Select
I have following sql syntax. This works fine but I was wondering if there
I have the following SQL statement: USE ws_results_db_2011_09_11_09_06_24;SELECT table_name FROM INFORMATION_SCHEMA.Tables WHERE table_name like
I have the following sql command through code and because the parameter contains a
I have the following sql query for transforming data but is it possible to
The following SQL statement has a syntax error according to phpMyAdmin, but I can't
The following sql query works fine on my development server running mysql 5, but
The following sql, with the MAX aggregrate function in the WHERE clause, does not
If I run the following SQL query SELECT * FROM A LEFT JOIN B

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.