将用户帐户注入 mySQL

发布于 2024-07-06 19:12:43 字数 562 浏览 4 评论 0原文

在这里处理一个奇怪的场景。

我们使用专有的工作站管理应用程序,该应用程序使用 mySQL 来存储其数据。 在应用程序中,它们提供大量报告,例如哪个用户在什么时间登录到哪台计算机、受监控计算机上安装的所有软件产品等等。 我们希望制作一组不同的报告,但是,它们不支持自定义报告。

由于他们的数据存储在 mySQL 中,我认为我可以手动进行报告。 但我没有有效的凭据来连接到 mySQL 服务器。 我是否可以在 mySQL 服务器中创建用户帐户?我不想重置 root 密码或其中可能存在的任何帐户,因为这可能会破坏应用程序。


我可以完全访问 Windows 2003 服务器。 我可以停止和重新启动服务,包括 mySQL 服务器。 对于实际的 mySQL 服务器,我只能通过软件提供的 GUI 进行基本访问。 我无法通过 CLI 或其他工具直接连接到它(由于缺乏凭据)。


如果我试图未经授权访问 mySQL 服务器,我深表歉意。 我已经联系了软件公司,截至今天已经两周没有得到他们的回复。 我需要获取数据。 我对物理盒子有完全的访问权限,我对其有管理员权限。

Tackling a strange scenario here.

We use a proprietary workstation management application which uses mySQL to store its data. Within the application they provide number of reports, such as which user logged into which machine at what time, all the software products installed on the monitored machines, so on and so forth. We are looking to do a different set of reports, however, they do not support custom reports.

Since their data is being stored in mySQL, I gather I can do the reporting manually. I don't have valid credentials to connect to the mySQL server though. Is there anyway for me to create a user account in the mySQL server? I do not want to reset the root password or anything account that might be in there, as it might break the application.


I have full access to the Windows 2003 server. I can stop and restart services, including the mySQL server. To the actual mySQL server, I only have basic access through the GUI provided by the software. I can't connect to it directly through CLI or through another tool (due to the lack of credentials).


I apologize if it came off as if I'm trying to get unauthorized access to the mySQL server. I have contacted the software company, and as of today it's been two weeks without a response from them. I need to get to the data. I have full access to the physical box, I have admin privileges on it.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(5

绝不放开 2024-07-13 19:12:43

您将需要使用 MySQL 密码恢复过程。 遵循这些说明,除了将密码重置查询替换为 添加新用户的查询。 新用户查询将类似于:

GRANT ALL ON *.* TO 'myuser'@'localhost' IDENTIFIED BY 'mypassword' WITH GRANT OPTION;

这将创建一个新用户“myuser”,密码为“mypassword”,该用户可以通过本地系统的 CLI 登录 MySQL。 然后,您可以使用 MySQL 管理员 GUI(在此处下载)并更新用户权限,以便您可以从网络上的其他系统登录。 或者使用 GRANT 语句从 CLI,如果这更符合您的风格。

You'll want to use the MySQL password recovery process. Follow these instructions, except replace the password reset query with a query to add a new user. The new user query would be something like:

GRANT ALL ON *.* TO 'myuser'@'localhost' IDENTIFIED BY 'mypassword' WITH GRANT OPTION;

That will create a new user "myuser" with the password "mypassword", who may log in to MySQL through the local system's CLI. You can then use the MySQL Administrator GUI (download here) and update user permissions so you can log in from other systems on the network. Or use the GRANT statement from the CLI, if that's more your style.

挽袖吟 2024-07-13 19:12:43

您是否有权访问相关 MySQL 服务器?

例如,除了普通用户之外,您还拥有哪些访问权限? 在“破解”之前,您应该尝试通过这些路线,因为对于该软件来说这可能可行,也可能不可行。

Do you have access to the MySQL server in question?

As in, what access do you have beyond what a regular user would? You should try to go through those routes before you "hack" your way in there, since that may or may not be feasible with that software.

佼人 2024-07-13 19:12:43

数据库端很可能有触发器保存日志,因此当您侵入数据库时​​,他们会知道您何时以及如何做到这一点。 这不是一个好主意。

odds are there are triggers on the database side keeping a log so when you hack yourself into the database they will know when and how you did it. Not a good idea.

善良天后 2024-07-13 19:12:43

我想我真的不应该回答这个问题,但这太有趣了。

查看有关 SQL 注入的页面。 这应该可以满足您的需求。
页面显示如何向 mySQL 添加用户帐户

我会尝试在随机用户输入字段中输入以下内容:(

p'; INSERT INTO user VALUES

'localhost','myNewAdmin',PASSWORD('some_pass'),
'Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y ','Y');

然后

p'; FLUSH PRIVILEGES;

p'; 旨在结束常规问题。 例如-
正常的问题是:

"Select Adress from cusomers where custName = ' + $INPUT + ';

变成

    Select Adress from cusomers where custName = 'p'; INSERT INTO user 
VALUES('localhost','myNewAdmin',PASSWORD('some_pass'), 
'Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y'); 

I assume I really should not answer this one, but it's just too much fun.

Look at This page about SQL injections. That should cover your needs.
This page shows how to add user accounts to mySQL

I would try entering the following in random user input fields:

p'; INSERT INTO user VALUES

('localhost','myNewAdmin',PASSWORD('some_pass'),
'Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y');

and then

p'; FLUSH PRIVILEGES;

p'; is intended to close the regular question. e.g -
Normal question is:

"Select Adress from cusomers where custName = ' + $INPUT + ';

becomes

    Select Adress from cusomers where custName = 'p'; INSERT INTO user 
VALUES('localhost','myNewAdmin',PASSWORD('some_pass'), 
'Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y'); 
回首观望 2024-07-13 19:12:43

想到的一件事是嗅探数据库通信并希望它没有加密。 如果它是加密的,请尝试更改配置以不使用 SSL 并重新启动 mysql。 我使用的一个好的嗅探器是 Wireshark

来自 mysql 5.0 文档

MySQL支持安全(加密)
MySQL 客户端之间的连接
使用安全套接字的服务器
层 (SSL) 协议。 本节
讨论如何使用 SSL 连接。
它还描述了一种设置 SSH 的方法
在 Windows 上。 有关如何进行的信息
要求用户使用 SSL 连接,
请参阅 REQUIRE 的讨论
GRANT 语句的子句
第 12.5.1.3 节,“GRANT 语法”。

MySQL的标准配置是
旨在尽可能快,所以
加密连接不被使用
默认。 这样做将使
客户端/服务器协议要慢得多。
加密数据是 CPU 密集型任务
需要电脑的操作
做额外的工作并且可能会延迟
其他 MySQL 任务。 对于应用程序
需要由以下人员提供的安全保障
加密连接,额外的
计算是有保证的。

MySQL允许启用加密
基于每个连接。 你可以
选择正常的未加密连接
或安全加密的 SSL 连接
根据要求
个人应用程序。

安全连接基于
OpenSSL API 可通过
MySQL C API。 复制使用
C API,因此安全连接可以
用于主从服务器之间。

您可能已经这样做了,但仍然尝试搜索应用程序配置文件。 如果没有任何内容 - 尝试搜索可执行文件/源代码 - 如果幸运的话,也许它是纯文本的。

One thing that comes in mind is sniffing the database communication and hope it's not encrypted. If it is encrypted try changing the configuration not to use SSL and restart mysql. A good sniffer that I use is Wireshark

From mysql 5.0 documentation:

MySQL supports secure (encrypted)
connections between MySQL clients and
the server using the Secure Sockets
Layer (SSL) protocol. This section
discusses how to use SSL connections.
It also describes a way to set up SSH
on Windows. For information on how to
require users to use SSL connections,
see the discussion of the REQUIRE
clause of the GRANT statement in
Section 12.5.1.3, “GRANT Syntax”.

The standard configuration of MySQL is
intended to be as fast as possible, so
encrypted connections are not used by
default. Doing so would make the
client/server protocol much slower.
Encrypting data is a CPU-intensive
operation that requires the computer
to do additional work and can delay
other MySQL tasks. For applications
that require the security provided by
encrypted connections, the extra
computation is warranted.

MySQL allows encryption to be enabled
on a per-connection basis. You can
choose a normal unencrypted connection
or a secure encrypted SSL connection
according the requirements of
individual applications.

Secure connections are based on the
OpenSSL API and are available through
the MySQL C API. Replication uses the
C API, so secure connections can be
used between master and slave servers.

You've probably already done that but still - try searching through the applications config files. If there's nothing - try searching through the executables/source code - maybe it's in plaintext if you're lucky.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文