Is SQL injection a threat with WMI?
For instance:
Given the following code, if domainName provided externally and is not disinfected, what could a potential attacker achieve?
string domainName = "user-inputted-domain.com"; string wql = "SELECT * FROM MicrosoftDNS_ATYPE WHERE OwnerName = '" + domainName + "'";
If this is a threat, which, in my opinion, is the best way to protect against it, instead of not using a normal parameterized query, how would I do with LINQ? Does removing any characters [ ' ] just do the trick?
And in another note, are there any LINQ extensions for the WMI request that will access this?
Edit: Found SelectQuery class. I have not tried it yet, but it seems to have more reliable query building capabilities, for example. a Condition .
source share