|
Richard Deeming wrote: It looks like somebody is trying to find and exploit a SQL Injection vulnerability in your site: I don't see anything in there to escape the current command executed.
You could still be correct, in line with post #2; if the connection-string is exposed, anyone could use that to issue commands. It would be something used to explore the database, which could still be valid use -
More questions; is there a table with that name? Have there been other commands from the same source? Could it have been generated by a tool? (Ever seen what traffic SQLSMS causes?)
Bastard Programmer from Hell
If you can't read my code, try converting it here[^]
|
|
|
|
|
There's likely a table with that name given it's a mybb forum, although I see where you're coming from, was it custom created for that purpose? Why would there be a table specifically for unreadpms for all users? I hadn't thought about that.
That thought worries me. They entrusted the SQL side of things to members that I personally did not know the reputation of, and I'm not sure how trustworthy they were (I personally hold the ethos you should only entrust to those you can trust).
All I know is information appears to leak from PM but only recently did I put two and two together (I'm not an admin on the site so it's not something I'd spotted conventionally).
Someone made vague insinuations another forum was dealing with an SQL injection, and that remark always bothered me. But I didn't want to prejudice the first hand analysis.
I think best course of action is to assume worse case scenario, assume there is an injection attempt and find a way to lock it down. If there isn't, site gets extra security and I just look daft, and if there is, everyone benefits.
So next question of course is how do you deal with a site that has presumably been attacked by an SQL injection?
|
|
|
|
|
Member 12662448 wrote: it's a mybb forum
Make sure you've installed the latest version of the forum software. There have been numerous vulnerabilities reported:
Mybb : Security vulnerabilities[^]
"These people looked deep within my soul and assigned me a number based on the order in which I joined."
- Homer
|
|
|
|
|
Every now and then the forum spews an error specifying the query. It's not in a log, the forum owners are friends and I've done a little bit of SQL for another project but my knowledge is minimal, so when I saw a query asking for unread PMs, it made me suspicious.
The query is verbatim from the error, not correctly formatted I suspect.
They would have no reason to run it, and they aren't SQL savvy enough to construct SQL queries of that nature. So whoever is running it is SQL savvy.
Other forums in our localised community have been hacked, with one fairly recently taken down (the admin's login details were stolen), and we often found information mentioned in PM was somehow 'known' publicly (I conducted experiments between my forum and theirs and found any info in PM on their forum leaked).
I didn't want to preload the dice in my favour by mentioning this, I wanted to see if the query could be an innocent outcome without the prejudicial information to hand.
The fact people are verifying it's asking for all users' unread PMs (as opposed to all PMs in general or a specific users' PMs) verifies my suspicions there's been a database breach.
Do you have any recommendations for securing a database against SQL injections (or maybe some way to test to see if it's vulnerable)?
I don't think extra security could hurt here even if I'm wrong.
Thank you for helping guys, it's all appreciated.
|
|
|
|
|
For testing, you can either manually try entering single quotes in various form fields, or use an automated tool like sqlmap[^].
NB: Make sure you have permission from the site owner before testing the site - preferably in writing.
Testing for SQL Injection (OTG-INPVAL-005) - OWASP[^]
To secure the site, you need to modify the code. You'll need to find every place where it issues a SQL query, and make sure it's using parameters. If it's using string concatenation, or string interpolation, or any other means of inserting data directly into the query text, then that's a potential vulnerability.
If your database has any stored procedures that build and execute a dynamic query, you'll also need to update those to use parameters. In Microsoft SQL Server, you would use sp_executesql[^]; other databases probably have something similar.
"These people looked deep within my soul and assigned me a number based on the order in which I joined."
- Homer
|
|
|
|
|
Thank you for the help so far.
I'll ask if I have permission to conduct a pentest, then I'll try to setup the software to conduct a check.
|
|
|
|
|
Hi there,
as the title already say, I'm searching for the right database for my use case which should work with the following data:
- 2 key/value "tables"
One which holds a string as key and a normal number as value, the second table should hold also a string as key and a string as value.
The first table should hold billions of string/number values, the second one should hold millions of string/string values. So there should be stored a huge amount of data.
The only operations I need to do are the following
- constantly add new entries in both tables
- before adding a new entry, check if the key (string) is already stored
- search for entries which share the same key in both tables. In a relational DB I would execute this statement (select * from tab1, tab2, where tab1.key = tab2.key) -> This search should be as fast as possible.
I'm experienced in any kind of relational DB like oracle, mssql, mysql, postgresql....
As key/value database I only used redis so far.
I think my use case is not good for relational databases. Some NoSQL databases meight be a better choice. Redis is not good as it is an in memory DB with data size limits of the physically memory. As I'm using lot of data I need something else.
Which database would you recommend in my case?
I'm excited to hear your suggestions.
Thank you for your help and have a nice day,
Kogs
|
|
|
|
|
|
Thanks for your suggestion.
I did some research and it looks that SQLite can handle big data very well. So this could work for me.
Nevertheless I think simple key/values store databases meight be faster. But I can also be wrong as I don't have much experience with NoSQL DBs.
|
|
|
|
|
Quote: I think my use case is not good for relational databases
Why you are thinking a relational db is wrong here? For me it looks like a rdb fits very good.
For example:
Quote: before adding a new entry, check if the key (string) is already stored
For this you can define the key as Primary or at least Unique. So, before insert you do not Need to check whether it is allready in. Simply insert, the db will tell you then, whether it was allready in. The Advantages: No multiply checks for unique values(one from you explicit, one from DB while checking constraints) and last but not least, no race condition.
[Edit]
One Thing more, MS SQL with its "Clusterd Index" fits Performance whise perfect for key/value pair.
There is only one Thing: "billions of string/number values" looks like you can not go for the free Version because of restricted db size.
modified 19-Jan-21 21:04pm.
|
|
|
|
|
Thanks for your answer.
I just thought that a key/values store meight be a better solution. They are usually designed to be fast with key/values... But I'm not very experienced with NoSQL DBs, so I meight be wrong with this.
If I use a relational db I know how to use PK. For the first table I still need to read it first, because if the key already exists, I also need to update the value of this entry. For the second table it would work just to let the DB check the constraint if the entry already exists or not.
MS SQL is not my first choice, because I also want it to work on Linux systems as well.
|
|
|
|
|
Some points to consider:
- are your keys case-sensitive? In MS SQL, string comparison is normally not case-sensitive, while with postgres or Oracle it is.
- what is the relation ship between the two tables? Do I understand you correctly that there are keys which exist in Table1 only, and other keys which exist in Table2 only?
- do you need some kind of reporting? I.e. how many different keys can be found for a value for keys exiting in both or only one table. Complex aggregation queries work fastest in MS SQL or Oracle, while mysql copes with simple aggregations only (but with two tables, that should still be ok).
- What would you do if a key to be added already exists? Update the record or throw an exception?
|
|
|
|
|
Thanks for your reply.
- the keys are all in uppercase in both tables, so a case sensitive match works perfect.
- The first table is the leading data store, the second table is more or less a lookup table. I want to check which entries in the lookup table exists also in the data store table.
- I don't need to search for any values, I need to search only for keys.
- If a key in the first table already exists, I need to update the value (increase the value)
- If a key in the second table already exists, nothing happens, just continue with the next one. But inserting doublicated entries in the secend table are extremly unlikely, so there is no need to check them. It's no problem if for some reason there are really doublicates, to add them twice. But if I use a rdbms and define the key as PK, this check is done automatically.
I will give it a try with a rdbms (not MS SQL because I want it to be available also on Linux systems).
But I'm wondering if a simple NoSQL DB (simple key/value) store meight not be faster in this case. I don't have much experience with NoSQL dbs, but I think they exist for a reason. And I want a really lightning fast solution
But if you think a normal sql db can be as fast (or faster) than I give it a try.
|
|
|
|
|
Your first point isn't a dealbreaker, it's easy enough to change collation in Sql Server or NLS-settings on an Oracle db.
|
|
|
|
|
Hi,
Im trying to make a ssis to load data from dynamic excel file that store in the folder. i've try every totorial but it still give me the error like this
[Connection manager "Excel Connection Manager"] Error: The connection string format is not valid. It must consist of one or more components of the form X=Y, separated by semicolons. This error occurs when a connection string with zero components is set on database connection manager.
Error: The result of the expression "@[User::FileName]" on property "\Package.Connections[Excel Connection Manager].Properties[ConnectionString]" cannot be written to the property. The expression was evaluated, but cannot be set on the property.
1. DelayValidation is set true.
2. Excel Connection String is set as
Provider=Microsoft.ACE.OLEDB.12.0;Data Source=D:\folde\Data\Book2.xlsx;Extended Properties="EXCEL 12.0 XML;HDR=YES";
that i store in variable
please advice.
thanks,
Vinny
|
|
|
|
|
Does the file "D:\folde\Data\Book2.xlsx" exist?
|
|
|
|
|
|
Just a thought. Maybe the connection string parser is being upset by the = inside the extended properties string.
Can you try without HDR=YES just to see if that is the problem?
Cheers,
Peter
Software rusts. Simon Stephenson, ca 1994. So does this signature. me, 2012
|
|
|
|
|
its give me another error
Error 3 Microsoft.SqlServer.Dts.Runtime.DtsRuntimeException: The package failed to load due to error 0xC0011008 "Error loading from XML. No further detailed error information can be specified for this problem because no Events object was passed where detailed error information can be stored.". This occurs when CPackage::LoadFromXML fails. ---> System.Runtime.InteropServices.COMException: The package failed to load due to error 0xC0011008 "Error loading from XML. No further detailed error information can be specified for this problem because no Events object was passed where detailed error information can be stored.". This occurs when CPackage::LoadFromXML fails. at Microsoft.SqlServer.Dts.Runtime.Wrapper.IDTSPackagePersist100.LoadPackageFromXML(Object vSource, Boolean vbSourceIsLocation, IDTSEvents100 pEvents) at Microsoft.SqlServer.Dts.Runtime.Package.LoadFromXML(String packageXml, IDTSEvents events) --- End of inner exception stack trace --- at Microsoft.SqlServer.Dts.Runtime.Package.LoadFromXML(String packageXml, IDTSEvents events) at Microsoft.SqlServer.Dts.Runtime.Project.LoadPackage(IProjectStorage storage, Package package, String streamName, IDTSEvents events) at Microsoft.SqlServer.Dts.Runtime.PackageItem.Load(IDTSEvents events) at Microsoft.SqlServer.Dts.Runtime.PackageItem.get_Package() at Microsoft.DataTransformationServices.Project.DataTransformationsProjectBuilder.IncrementalBuildThroughObj(IOutputWindow outputWindow) at Microsoft.DataTransformationServices.Project.DataTransformationsProjectBuilder.BuildIncremental(IOutputWindow outputWindow) 0
but, when i put HDR=YES the error was change. it says neesd new metadata, its seem like i have different format of file. event thought the file was the same.
|
|
|
|
|
It is very difficult to guess what is going on without more information about the actual code that causes the exception. Please show the code where the error occurs, indicating the exact line that raises the exception, and the exact content of all variables that are being used.
|
|
|
|
|
I want to encrypt email to 6-8 character alphanumeric string in sql server. Is this possible?
Thanks
|
|
|
|
|
Most unlikely no. How would you encrypt something like "ihaveaverylongnameincludingahyphen@mylogsurname.microsoft.com", without losing some characters?
|
|
|
|
|
i have three tables
1) products
=======================
with following columns:
product_id
product_cat
product_cat_brand
product title
product_price
product_image
product_Category
=======================
with following columns
cat_id
cat_title
product_Brand
=======================
with following columns:
brand_id
brand_title
===============
Question???:
================
so my question is:
which table will receive the foreign key of which other table?
or in other words how i can make relations between these tables..
|
|
|
|
|
From what you show only the following can be done/makes sense:
products
(
....
CONSTRAINT FK_products_cat FOREIGN KEY (product_cat) REFERENCES product_Category(cat_id)
)
You need to think again about the layout. It seems that products needs something like product_Brand instead of product_cat_brand. In case this assumption is right then:
products
(
....
CONSTRAINT FK_products_cat FOREIGN KEY (product_cat) REFERENCES product_Category(cat_id)
CONSTRAINT FK_products_brand FOREIGN KEY (product_brand) REFERENCES product_Brand(brand_id)
)
modified 19-Jan-21 21:04pm.
|
|
|
|
|
Hi every body,
I have a very special an uncommon! issue with CDC data migration, this is my problem: we had enabled CDC backup on our DB setting cleanup date for 2 years, so after 2 years we have old CDC data only in DB backups, now our customer needs reports base on CDC data in past 4 years, so the only way we can do that is reinserting old CDC data in corresponding tables by script, we replaced "change_tables" and "lsn_time_mapping" and set the data cleanup date for 10 years. every thing is OK until the cleanup job runs and removes the old data, is some data missed for restoring or is any setting avoid this cleanup?
every suggestion would be appreciated
thanks
|
|
|
|
|