Home Database Mysql Tutorial 如何防止Access2000密码被破译的方法

如何防止Access2000密码被破译的方法

Jun 07, 2016 pm 03:11 PM
how password method prevent

如果你过分信任 Access 2000数据库的 密码 保护,你可能会因此而蒙受损失。这是因为Access 2000的数据库级 密码 并不安全,相反它很脆弱,甚至下面这段非常小的程序就可以攻破它: ' 程序一(VB6):Access 2000 密码 破译 Private Sub Command1_Click() Cons

如果你过分信任 Access 2000数据库的密码保护,你可能会因此而蒙受损失。这是因为Access 2000的数据库级密码并不安全,相反它很脆弱,甚至下面这段非常小的程序就可以攻破它:

' 程序一(VB6):Access 2000密码破译

Private Sub Command1_Click()

Const Offset = &H43 ' 文件偏移地址:Access数据库从此处开始存放加密密码

Dim bEmpty(1 To 2) As Byte, bPass(1 To 2) As Byte

Dim I As Integer, Password As String

' 打开一个空数据库作为参照

Open "D:VB6_TestMDB_PasswordNew_Empty_DB.mdb" For Binary As #1

' 打开被密码保护的数据库

Open "D:VB6_TestMDB_PasswordPass_Protected_DB.mdb" For Binary As #2

Seek #1, Offset

Seek #2, Offset

For I = 1 To 20 ' Access 2000 数据库密码最长允许20位

Get #1, , bEmpty ' 其中每位密码占两个字节

Get #2, , bPass ' 一个汉字也仅是一位密码,占两个字节

If (bEmpty(1) Xor bPass(1)) 0 Then

Password = Password + Chr(bEmpty(1) Xor bPass(1)) ' 将密码解密

End If

Next

Close 1, 2

MsgBox "Password:" + Password ' 显示密码

End Sub

一、深入分析

上述程序成功的关键是使用了一个空数据库(New_Empty_DB.mdb)。该数据库的创建日期必须与被密码保护的数据库(Pass_Protected_DB.mdb)相一致。 换句话说,Access 2000 仅仅是使用“数据库创建日期”来加密用户密码

应注意的是:上面的“创建日期”只是操作系统级的,也就是 Windows记录在文件夹目录里的信息(根据文件名的长短,每个文件在目录里占用至少32个字节,包括:文件名、属性、文件大小、首蔟号、创建时间、修改时间和访问时间等)。

Access 2000 在数据库中也记录了该数据库的“创建日期”。加密数据库密码的正是数据库内部记录的这个“创建日期”。该日期只有在数据库被成功打开后才能看到。但在一般情况下,操作系统级的以及数据库内保存的“创建日期”是完全一样的,因此这为破译者提供了方便。

上述程序中还有一点需要说明:为简明起见,解密密码时仅处理了双字节的首字节,因此它仅对非汉字密码有效。若要解密汉字密码,须对双字节均做处理。

二、防范措施

1、隐藏“创建日期”

从上面的分析可以看出,既然“创建日期”是破译的关键,那么我们应“对症下药”,将真实的“创建日期”隐藏起来。

第一步,创建数据库时,使用一个“不可思议的、别人不易猜测”的日期。做法为:修改 Windows系统日期,例如改为2026年05月15日,创建数据库后再将系统日期改回。这个“不可思议”的日期即为该数据库的真实“创建日期”。

第二步,修改操作系统级的“创建日期”。上述第一步完成后,该数据库在操作系统级的创建日期也是2026年05月15日,必须加以修改,以达到隐藏真实创建日期的目的。修改操作系统级的“创建日期”可以由下面的程序二完成。

' 程序二(VB6):修改文件在操作系统级的“创建日期”

Private Type FILETIME

dwLowDateTime As Long

dwHighDateTime As Long

End Type

Private Type SYSTEMTIME

wYear As Integer

wMonth As Integer

wDayOfWeek As Integer

wDay As Integer

wHour As Integer

wMinute As Integer

wSecond As Integer

wMilliseconds As Integer

End Type

Private Const GENERIC_WRITE = &H40000000

Private Const OPEN_EXISTING = 3

Private Const FILE_SHARE_READ = &H1

Private Const FILE_SHARE_WRITE = &H2

Private Declare Function SetFileTimeWrite Lib "kernel32" Alias _

"SetFileTime" (ByVal hFile As Long, lpCreateTime As FILETIME, _

ByVal NullP As Long, ByVal NullP2 As Long) As Long

Private Declare Function SystemTimeToFileTime Lib "kernel32" _

(lpSystemTime As SYSTEMTIME, lpFileTime As FILETIME) As Long

Private Declare Function CreateFile Lib "kernel32" Alias "CreateFileA" _

(ByVal lpFileName As String, ByVal dwDesiredAccess As Long, ByVal _

dwShareMode As Long, ByVal lpSecurityAttributes As Long, ByVal _

dwCreationDisposition As Long, ByVal dwFlagsAndAttributes As Long, _

ByVal hTemplateFile As Long) As Long

Private Declare Function CloseHandle Lib "kernel32" (ByVal hObject As Long) _

As Long

Private Declare Function LocalFileTimeToFileTime Lib "kernel32" _

(lpLocalFileTime As FILETIME, lpFileTime As FILETIME) As Long

Private Sub Command1_Click()

Dim Year As Integer, Month As Integer, Day As Integer

Dim Hour As Integer, Minute As Integer, Second As Integer

Dim TimeStamp As Variant, Filename As String, X As Integer

Year = 2001: Month = 3: Day = 13 ' 准备设定的“创建日期”

Hour = 12: Minute = 0: Second = 26

TimeStamp = DateSerial(Year, Month, Day) + TimeSerial(Hour, Minute, Second)

Filename = "D:VB6_TestMDB_PasswordPass_Protected_DB.mdb" ' 目标文件名

X = ModifyFileStamp(Filename, TimeStamp)

End Sub

Function ModifyFileStamp(Filename As String, TimeStamp As Variant) As Integer

Dim X As Long, Handle As Long, System_Time As SYSTEMTIME

Dim File_Time As FILETIME, Local_Time As FILETIME

System_Time.wYear = Year(TimeStamp): System_Time.wMonth = Month(TimeStamp)

System_Time.wDay = Day(TimeStamp)

System_Time.wDayOfWeek = Weekday(TimeStamp) - 1

System_Time.wHour = Hour(TimeStamp): System_Time.wSecond = Second(TimeStamp)

System_Time.wMilliseconds = 0

X = SystemTimeToFileTime(System_Time, Local_Time)

X = LocalFileTimeToFileTime(Local_Time, File_Time) ' 转换成可用的类型

Handle = CreateFile(Filename, GENERIC_WRITE, FILE_SHARE_READ Or _

FILE_SHARE_WRITE, ByVal 0&, OPEN_EXISTING, 0, 0) ' 打开文件

X = SetFileTimeWrite(Handle, File_Time, ByVal 0&, ByVal 0&) ' 设置日期

CloseHandle Handle ' 关闭文件

End Function

可以看出,隐藏“创建日期”的方法对破译者来说只是增大了破译的工作量,增加了破解试验的次数。只有将该方法与下述的“方法二”相结合,才能达到“既治标又治本”的效果。不过在一般的情况下“方法一”已够用,因为如果破译者起始使用的测试日期与最终的真实日期相差百年,他需要付出数万次的努力!

2、使用用户级安全机制

通过设置不同的用户帐号和组帐号对数据库中的各种资源进行权限管理。这种加强了的安全机制虽然给日常使用(尤其是单用户使用)带来了不便,但在有安全隐患的地方依然有设置的必要。

三、结论

所谓“道高一尺魔高一丈”,因为这世上并没有绝对的安全。上述方法一的目的是提高破译的成本以达到常人难以接受的程度;而方法二的初衷是增加密码的数量。两种方法的结合足以使破译者望而却步。不过这并不意味着百分之百的安全。但从思想上提高安全意识,防患于未然,这毕竟是正确的选择。
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn

Hot AI Tools

Undresser.AI Undress

Undresser.AI Undress

AI-powered app for creating realistic nude photos

AI Clothes Remover

AI Clothes Remover

Online AI tool for removing clothes from photos.

Undress AI Tool

Undress AI Tool

Undress images for free

Clothoff.io

Clothoff.io

AI clothes remover

AI Hentai Generator

AI Hentai Generator

Generate AI Hentai for free.

Hot Article

R.E.P.O. Energy Crystals Explained and What They Do (Yellow Crystal)
4 weeks ago By 尊渡假赌尊渡假赌尊渡假赌
R.E.P.O. Best Graphic Settings
4 weeks ago By 尊渡假赌尊渡假赌尊渡假赌
R.E.P.O. How to Fix Audio if You Can't Hear Anyone
4 weeks ago By 尊渡假赌尊渡假赌尊渡假赌
R.E.P.O. Chat Commands and How to Use Them
4 weeks ago By 尊渡假赌尊渡假赌尊渡假赌

Hot Tools

Notepad++7.3.1

Notepad++7.3.1

Easy-to-use and free code editor

SublimeText3 Chinese version

SublimeText3 Chinese version

Chinese version, very easy to use

Zend Studio 13.0.1

Zend Studio 13.0.1

Powerful PHP integrated development environment

Dreamweaver CS6

Dreamweaver CS6

Visual web development tools

SublimeText3 Mac version

SublimeText3 Mac version

God-level code editing software (SublimeText3)

How to write a novel in the Tomato Free Novel app. Share the tutorial on how to write a novel in Tomato Novel. How to write a novel in the Tomato Free Novel app. Share the tutorial on how to write a novel in Tomato Novel. Mar 28, 2024 pm 12:50 PM

Tomato Novel is a very popular novel reading software. We often have new novels and comics to read in Tomato Novel. Every novel and comic is very interesting. Many friends also want to write novels. Earn pocket money and edit the content of the novel you want to write into text. So how do we write the novel in it? My friends don’t know, so let’s go to this site together. Let’s take some time to look at an introduction to how to write a novel. Share the Tomato novel tutorial on how to write a novel. 1. First open the Tomato free novel app on your mobile phone and click on Personal Center - Writer Center. 2. Jump to the Tomato Writer Assistant page - click on Create a new book at the end of the novel.

How to solve the problem that Windows 11 prompts you to enter the administrator username and password to continue? How to solve the problem that Windows 11 prompts you to enter the administrator username and password to continue? Apr 11, 2024 am 09:10 AM

When using Win11 system, sometimes you will encounter a prompt that requires you to enter the administrator username and password. This article will discuss how to deal with this situation. Method 1: 1. Click [Windows Logo], then press [Shift+Restart] to enter safe mode; or enter safe mode this way: click the Start menu and select Settings. Select "Update and Security"; select "Restart Now" in "Recovery"; after restarting and entering the options, select - Troubleshoot - Advanced Options - Startup Settings -&mdash

How to enter bios on Colorful motherboard? Teach you two methods How to enter bios on Colorful motherboard? Teach you two methods Mar 13, 2024 pm 06:01 PM

Colorful motherboards enjoy high popularity and market share in the Chinese domestic market, but some users of Colorful motherboards still don’t know how to enter the bios for settings? In response to this situation, the editor has specially brought you two methods to enter the colorful motherboard bios. Come and try it! Method 1: Use the U disk startup shortcut key to directly enter the U disk installation system. The shortcut key for the Colorful motherboard to start the U disk with one click is ESC or F11. First, use Black Shark Installation Master to create a Black Shark U disk boot disk, and then turn on the computer. When you see the startup screen, continuously press the ESC or F11 key on the keyboard to enter a window for sequential selection of startup items. Move the cursor to the place where "USB" is displayed, and then

How to recover deleted contacts on WeChat (simple tutorial tells you how to recover deleted contacts) How to recover deleted contacts on WeChat (simple tutorial tells you how to recover deleted contacts) May 01, 2024 pm 12:01 PM

Unfortunately, people often delete certain contacts accidentally for some reasons. WeChat is a widely used social software. To help users solve this problem, this article will introduce how to retrieve deleted contacts in a simple way. 1. Understand the WeChat contact deletion mechanism. This provides us with the possibility to retrieve deleted contacts. The contact deletion mechanism in WeChat removes them from the address book, but does not delete them completely. 2. Use WeChat’s built-in “Contact Book Recovery” function. WeChat provides “Contact Book Recovery” to save time and energy. Users can quickly retrieve previously deleted contacts through this function. 3. Enter the WeChat settings page and click the lower right corner, open the WeChat application "Me" and click the settings icon in the upper right corner to enter the settings page.

How to set router WiFi password using mobile phone (using mobile phone as tool) How to set router WiFi password using mobile phone (using mobile phone as tool) Apr 24, 2024 pm 06:04 PM

Wireless networks have become an indispensable part of people's lives in today's digital world. Protecting the security of personal wireless networks is particularly important, however. Setting a strong password is key to ensuring that your WiFi network cannot be hacked by others. To ensure your network security, this article will introduce in detail how to use your mobile phone to change the router WiFi password. 1. Open the router management page - Open the router management page in the mobile browser and enter the router's default IP address. 2. Enter the administrator username and password - To gain access, enter the correct administrator username and password in the login page. 3. Navigate to the wireless settings page - find and click to enter the wireless settings page, in the router management page. 4. Find the current Wi

How to set font size on mobile phone (easily adjust font size on mobile phone) How to set font size on mobile phone (easily adjust font size on mobile phone) May 07, 2024 pm 03:34 PM

Setting font size has become an important personalization requirement as mobile phones become an important tool in people's daily lives. In order to meet the needs of different users, this article will introduce how to improve the mobile phone use experience and adjust the font size of the mobile phone through simple operations. Why do you need to adjust the font size of your mobile phone - Adjusting the font size can make the text clearer and easier to read - Suitable for the reading needs of users of different ages - Convenient for users with poor vision to use the font size setting function of the mobile phone system - How to enter the system settings interface - In Find and enter the "Display" option in the settings interface - find the "Font Size" option and adjust it. Adjust the font size with a third-party application - download and install an application that supports font size adjustment - open the application and enter the relevant settings interface - according to the individual

The secret of hatching mobile dragon eggs is revealed (step by step to teach you how to successfully hatch mobile dragon eggs) The secret of hatching mobile dragon eggs is revealed (step by step to teach you how to successfully hatch mobile dragon eggs) May 04, 2024 pm 06:01 PM

Mobile games have become an integral part of people's lives with the development of technology. It has attracted the attention of many players with its cute dragon egg image and interesting hatching process, and one of the games that has attracted much attention is the mobile version of Dragon Egg. To help players better cultivate and grow their own dragons in the game, this article will introduce to you how to hatch dragon eggs in the mobile version. 1. Choose the appropriate type of dragon egg. Players need to carefully choose the type of dragon egg that they like and suit themselves, based on the different types of dragon egg attributes and abilities provided in the game. 2. Upgrade the level of the incubation machine. Players need to improve the level of the incubation machine by completing tasks and collecting props. The level of the incubation machine determines the hatching speed and hatching success rate. 3. Collect the resources required for hatching. Players need to be in the game

Incorrect password, beware BitLocker warning Incorrect password, beware BitLocker warning Mar 26, 2024 am 09:41 AM

This article will explore how to solve the problem of wrong password, especially the need to be careful when dealing with BitLocker warnings. This warning is triggered when an incorrect password is entered multiple times in BitLocker to unlock the drive. Usually, this warning occurs because the system has a policy that limits incorrect login attempts (usually three login attempts are allowed). In this case, the user will receive an appropriate warning message. The complete warning message is as follows: The password entered is incorrect. Please note that continuously entering incorrect passwords will cause the account to be locked. This is to protect the security of your data. If you need to unlock your account, you will need to use a BitLocker recovery key. The password is incorrect, beware the BitLocker warning you receive when you log in to your computer

See all articles