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

My following SQL is not working but when I use same regular expression in
In the following SQL statement, SQLite sorts correctly but MySQL does not: However, if
I have the following SQL (SQL Server 2005) that I use to calculate the
The following SQL statement has a syntax error according to phpMyAdmin, but I can't
I have the following SQL/Server function defined in C# to detect when a vehicle
I want to write following sql using projection in hibernate SELECT id, name, MAX(ver)
The following SQL query works perfectly fine when I run it with PHPMyAdmin but
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
I have the following sql query for transforming data but is it possible to

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.