Software Vulnerabilities Exercise 2

【信息科学与工程学】【安全领域】第一百一十四篇 零信任网络02 生成式模型可能产生不存在的细节或误解。如何通过抽取式和生成式混合方法? 阅读详情


Software Vulnerabilities Exercise 2 - Basic buffer overffow exploits for
the receiver application
P Evans
October 31, 2024
1 Overview and Objectives
In the previous exercise you saw that by sending too much data to the networking application you can cause it
to crash or behave in an unexpected way. This session will look at how if you send a vulnerable program too
much data, but this data is carefully chosen, you can alter the commands that the program executes and change
its behaviour in a controlled way. In Exercise3 you’ll then look at how you can cause the programs to execute
arbitrary commands that the programmer never intended.
After the this exercise you should:
Know what a stack buffer overffow is and why it is dangerous
Understand how a buffer overffow can be used to force a vulnerable program to behave in ways that the
original programmer didn’t intend.
Understand how a debugger can be used to analyse a program to determine the memory locations used
to store variables and functions.
1.1 Objective 2.1: Simplify the receiver application
To analyse the buffer overffow vulnerability we dont need to include all of the networking code developed
in the last exercise.
You will create a copy of the receiver application Code::Blocks project that contains the same processMessage()
function, but without the networking code.
This is just to make the following exercises a bit easier, you will use the networked application again later.
1.2 Objective 2.2: Analyse the consequences of a buffer overffow in more detail
Last week you saw that by putting too much data in either the username or content ffelds could cause the
program to crash.
The point of this exercise is to show why the program crashes (the mechanism that actually causes the
crash)
You will need to learn how to use the debugger to do this.
1.3 Objective 2.3: Exploiting the overffow to falsify (or spoof ) the sender’s username

By sending a carefully chosen bad message, you can trick the receiving application into telling the user
that the message came from someone it didnt.
You need to understand how to create this message and why this works.
11.4 Objective 2.4: Changing the ffow of a program’s execution
The spooffng example above just illustrates how overffowing a character string can inffuence other variables
with a program.
This example (and the advanced examples on the next work sheet) show how an overffow can actually
change the behaviour of the program - in this case that is to skip over lines of code that should normally
be executed.
22 Guidance for Objective 2.1: Simplify the receiver application
To analyse the buffer overffow vulnerability we don’t need to include all of the networking code developed in
the last exercise. We will introduce this again later but its better to simplify the program for now. The ffrst
task is to create a new Code::Blocks project and enter the following code in main.c. This code is the same as
for the receiver program you looked at last week except that the message is speciffed in the code, rather than
being received through a network socket. We will go back to the networked code later, this just makes testing
easier as you don’t need to run two programs!
Create the new project and make this change to the project settings:
Right click on the project name in the project viewer (tree view to left of screen) and select Build Options.
Go to the Compiler settings tab, then Other compiler options and add the text: -fno-unwind-tables -o0.
This just simpliffes the code that the compiler generates which may help later if you disassemble the
program, the methods demonstrated should still work without these options - we are not cheating!
Now enter the following code as your program. You can download the code from Moodle if you prefer (look for
SupplementaryMaterial/oftest.c):
1 #inc lude <s t d i o . h>
2 #inc lude <s t d l i b . h>
3 #inc lude <s t r i n g . h>
4 #inc lude <windows . h>
5
6 /* Use o f g l o b a l v a r i a b l e not i d e a l but i t
7 * makes some the examples much e a s i e r ! */
8 char message [ 4 0 9 6 ] ;
9
10
11 void proc e s sMe s sage () {
12 char senderName [ 7 0 ] ;
13 char messageContent [ 1 8 0 ] ;
14
15 /* Ext ract the message */
16 s t r cpy ( senderName , message ) ;
17 s t r cpy ( messageContent , message+s t r l e n ( senderName )+1 ) ;
18
19 /* Di splay the message */
20 p r i n tf ( ”\n
===============================================================================\n”
21 ”Message from : %.69 s \n”
22 ”===============================================================================\n”
23 ”%.179 s \n”
24 ”===============================================================================\n\
n\n\n” ,
25 senderName , messageContent ) ;
26
27 r e turn ;
28 }
29
30
31 i n t readInput ( char * input ) {
32 char * inpt r , * outpt r , hex [ 3 ] ;
33
34 // read l i n e from keyboard input
35 g e t s ( input ) ;
36
37 // need to conve r t any hexadecimal cha r a c t e r codes to c h a r a c t e r s
38 // This a ll ows you to ent e r non=a s c i i c h a r a c t e r s in l a t e r e x e r c i s e s
39 hex [ 2 ] = ’ \0 ’ ;
40 in pt r = outpt r = input ;
41 whil e ( * in pt r ) {
42 i f ( * in pt r == ’ \\ ’ && *( in pt r +1) == ’ x ’ ) {
343 hex [ 0 ] = *( in pt r +2) ;
44 hex [ 1 ] = *( in pt r +3) ;
45 * outpt r++ = ( char ) s t r t o l ( hex , NULL, 16 ) ;
46 in pt r += 4 ;
47 } e l s e {
48 * outpt r++ = * in pt r++;
49 }
50 }
51
52 * outpt r = ’ \0 ’ ;
53
54 r e turn s t r l e n ( input ) ;
55 }
56
57
58 i n t main () {
59 i n t nameSize , c ont entSi z e ;
60 i n t i ;
61 i n t j = 0 ;
62
63 /* Put the username and message int o a b u ff e r to s imul a t e the data that
64 * would be r e c e i v e d in the networked a p p l i c a ti o n */
65 p r i n tf ( ”Enter username : ” ) ;
66 nameSize = readInput ( message ) ;
67 p r i n tf ( ”Enter message : ” ) ;
68 c ont entSi z e = readInput ( message+s t r l e n ( message )+1 ) ;
69
70 /* Di splay inf o rma ti on about the mes s sage */
71 p r i n tf ( ”\nUsername : %s \n” , message ) ;
72 p r i n tf ( ”Message : %s \n” , message+s t r l e n ( message )+1 ) ;
73
74 p r i n tf ( ”\nBytes : ” ) ;
75 f o r ( i = 0 ; i < nameSize + c ont entSi z e + 2 ; i++ ) {
76 p r i n tf ( ”%02x ” , ( uns igned char ) message [ i ] ) ;
77 }
78 p r i n tf ( ”\n [ username=%d char s , cont ent=%d char s ] \ n\n” , nameSize , c ont entSi z e ) ;
79
80 /* Call the pr o c e s s message func ti on same as in Exe r c i s e 1 */
81 proc e s sMe s sage ( message ) ;
82
83 /* Some a r b it r a r y commands to exe cut e a ft e r the proc e s sMe s sage func ti on
84 * ( t h i s w i l l make s ens e l a t e r ! ) */
85 j = j + 1 ;
86 j = j + 1 ;
87 j = j + 1 ;
88 p r i n tf ( ”The f i n a l value o f j i s %d\n” , j ) ;
89
90 r e turn 0 ;
91 }
Note that there are a few arbitrary commands after processMessage() is called - these will be used to illustrate
how an overffow can change the code that is executed when the program runs.
Build and run the application and if all is well, you should see the output shown in Figure 1
4Figure 1: Expected output from the simpliffed application
3 Guidance for Objective 2.2: Analyse the consequences of a buffer
overffow in more detail
Last week you saw that by putting too much data in either the username or content ffelds could cause the
program to crash. The point of this exercise is to show why the program crashes (the mechanism that actually
causes the crash) and then to show why this mechanism is actually a signiffcant cybersecurity vulnerability.
Based on what we covered in the previous lectures we can start by drawing a diagram of the stack region of
memory in the processMemory function, this is shown in Figure 2.
Figure 2: Structure of stack within processMessage()
The stack region of memory is used to store the variables that are used within the function (senderName and
processMessage). The basic principle behind a buffer overffow is that by putting too much information in one
variable you can also overwrite another variable that you are not supposed to be able to access. Since the stack
5grows downwards on most common systems, overflowing a variable allows you to modify any variable that was
created previously.
3.1 Find Offset1 using the gdb debugger
First you will confirm the value for Offset1 in Figure 2. You would expect that the memory address for senderName
should be equal to the memory address for messageContent + 180bytes but you will need to check that
this is the case as in some cases the compiler will insert padding between variables on the stack.
To do this you can use the debugger that is built into Code::Blocks. A debugger is used to analyse a program
in detail while is running and is usually used to find reasons why a program may be crashing or behaving
unexpectedly. In this case you will use the debugger in a very simple way to find the memory addresses of some
variables.
For some reason the path to the debugger executable (gdb32.exe) is not always configured in Code::Blocks.
To check/correct this, go the the Settings item in the toolbar, then choose Debugger. Click the default tab, and
look at the Executable Path option, if this is red then the debugger isn’t configured. You’ll need to select the
gdb32.exe executable at: Code::Blocks directory/MinGW/bin/gdb32.exe.
Figure 3: Configuring the debugger in Code::Blocks.
Before running the debugger you need to define a breakpoint, a breakpoint is just a specific point in the program
where the program will pause to allow you to use the debugger. In this case you want to use the debugger to
analyse the variables in the processMessage() function so you need to set a breakpoint there, we will set the
breakpoint at the end of the function so we can see what the final value of all variables is. Left click in the
margin of the Code::Blocks editor just before the return; statement in processMessage(). A red circle will appear
to show that the breakpoint has been set. Once you’ve added the breakpoint you need to run the program using
the debugger. Click the red arrow in the toolbar and the program should run but then pause at the location
you specified. See figure 4.
A yellow arrow will appear in the margin to show where the program has paused and this will also be displayed
in the debugging window, a command window should be availble at the bottom of the screen where you
can type debugging commands. See figure 5.
You now need to find the memory addresses used for the senderName and messageContent buffers. To do this
you use the examine command. Type x senderName in the debugger command window and you’ll get an output
that consists of two hexadecimal numbers:
1 > x senderName
2 0 x 2 8 f e a 0 : 0 x6c756150
The first number (0x28fea0 ) is the address stored in the string pointer and the second number (0x6c756150 ) is
the first 4 bytes of data that can be found at this address but in reverse order (0x6c = l, 0x75 = u, 0x61 =
a, 0x50 = P - see an ASCII table). You can ignore the second number for now as we’re just interested in the
6Figure 4: Setting a breakpoint in the processMessage() function and running the debugger using Code::Blocks.
address of these variables. Find the address of both senderName and messageContent and from these confirm
the value of Offset1:
(a) Address of senderName: ........
Figure 5: The debugger is now running and has paused at a breakpoint in the processMessage() function
(indicated by yellow arrow). The debugger command window is available for you to type commands.
7 (b) Address of messageContent: ........
(c) Offset1 = (a) - (b): ........
You can use the Windows calculator in programmer mode to perform calculations on hexadecimal numbers.
Note on memory address formatting: The 0xXXXXXXXX formatting string is memory address
in hexadecimal formal, prefixed by 0x, i.e. the XXXXXXXX part is a hecadecimal number
representing the memory addresses. This is a common format for displaying memory addresses
and other hexadecimal numbers in many applications.
3.2 Use Offset1 to investigate the effects of an overflow
If you computed offset 1 to be 180, you should be able to set the message content string to contain up to 179
characters without overflowing (remember that 1 character is needed for the NULL byte string terminator),
Check you are happy with your values for offset 1 though - don’t just assume it is 180!. Now
you need to find out what happens when you put too many characters in the string and run the program, it
is a good idea to prepare your strings in a text editor and paste them into the program so you don’t need to
rewrite them everytime. If you download a programming text editor like Notepad++, it will tell you how many
characters are on each line which will help you generate strings that are the correct length.
Try changing the message content string so that it is exactly (offset1-1) bytes long.The program will tell
you how long each string you’ve entered. Make the string longer by adding some characters before ”hello”
so hello remains at the end of the string.
Add 1 more padding character and rerun the program. What happens? (Look at the displayed username)
Add a few more padding characters before Hello. What happens? Why is this?
84 Guidance for Objective 2.3: Exploiting the overflow to falsify (or
spoof ) the sender’s username
Hopefully you have seen how putting too much data in a buffer can overflow that buffer and cause other variables
that are stored nearby to be modified. This can allow an attacker to modify variables within a program that
they shouldn’t be able to, in this case it allows someone to change the contents of the senderName buffer by
sending a message whose content exceeds the length of the messageContent buffer.
You now need to demonstrate how this overflowing technique could be dangerous. The idea is to trick the
processMessage function into displaying an incorrect username for the message sender.
Enter the username and content messages as something like:
1 Enter username : A Hacker
2 Enter message : H ell o
If you run your program the output should be:
1 ===============================================================================
2 Message from : A Hacker
3 ===============================================================================
4 H ell o
5 ===============================================================================
You need to add some additional information to the message content string so that it overflows the messageContent
buffer and overwrites the senderName buffer in processMessage(). The idea is to overwrite the real
username ”A Hacker” with something else. The overflow padding you use should be transparent to the user
when printed to screen by the processMessage() function.
Once you’ve worked out what the message content should be, try it out on your sender/receiver applications.
Open the sender application and enter your username as ”A Hacker” and then try to send a message that
appears to come from another username. Develop the correct string using the application from this exercise,
then test on the networked application from last week.
You should be able to reproduce the results in figure 6. Make a note of the username and message strings
that you used.
9Figure 6: Spoofed username in sender & receiver applications using a buffer overflow. Despite the username
specified in the sender program being ”A Hacker”, the second message appears to come from a user called
”Paul”
105 Guidance for Objective 2.4: Changing the flow of a program’s
execution
The spoofing example above just illustrates how overflowing a character string can influence other variables
with a program. In many real cyber attacks the overflow technique is actually used in a different and more
dangerous way.
5.1 The theory
As discussed in the previous lectures, the processor relies on one of its registers (EIP for a 32bit application) to
tell it where to find the next instruction to execute. When the processor encounters a function call, it has two
possible values for EIP:
The address of the next instruction if the processor enters the function.
The address of the next instruction if the processor does not enter the function.
Take the lab2 example program:
1 /* ** ======================= E x t r ac t from main ( ) ======================= ** */
2 p r o c e s sM e s s a g e ( message ) ;
3
4 j = j + 1 ;
5 j = j + 1 ;
6 j = j + 1 ;
7 /* ** ====================== /E x t r ac t from main ( ) ======================= ** */
1 /* ** ================== E x t r ac t from p r o c e s sM e s s a g e ( ) ================== ** */
2 v oid p r o c e s sM e s s a g e ( c o n s t ch a r * message ) {
3 ch a r senderName [ 7 0 ] ;
4 ch a r messageContent [ 1 8 0 ] ;
5
6 s t r c p y ( senderName , message ) ;
7 s t r c p y ( messageContent , message+s t r l e n ( senderName )+1 ) ;
8 .
9 .
10 .
11 r e t u r n ;
12 /* ** ================= /E x t r ac t from p r o c e s sM e s s a g e ( ) ================== ** */
When the processor reaches the line processMessage( message ), the flow of execution must transfer into the
processMessage() function. This means that the EIP register will be set to the address of the first instruction in
processMessage() - somewhere just before strcpy( senderName, message ). Had this jump into processMessage()
not occured, the next instruction would have been j = j + 1 in main().
Before the processor jumps into processMessage(), it needs to remember where it would have gone if the function
call hadn’t happened - because this is where it needs to go back to when processMessage() returns. It does this
by saving the alternative EIP value onto the stack so that it can be reloaded when processMessage returns.
In addition to saving the return EIP value onto the stack, one more variable is saved. This is the content
of another register called EBP, this register tells the processor where in the stack it can find the variables belonging
to the current function. When the processor enters processMessage(), EBP changes to the address where
processMessage()’s variables (senderName, messageContent) are located. When the function returns back to
main(), EBP must be changed back to point to the location where main()’s variables are located (username,
content, messageSize, i, j). The old EBP value is therefore also saved to the stack so that it can be restored
when processMessage() returns.
Important: The key point to understand is that when the processMessage() is running, there are two variables
stored on the stack just above senderName and messageContent. These two variables describe how to get back
to main() from processMessage(): one tells the processor where the next instruction in main() is, and one tells it
where to find main()’s variables again. If you overflow senderName or messageContent and overwrite either the
saved EBP or EIP variables, the program will most likely crash when it tries to return from processMessage()
11because you will have corrupted the information that the processor needs to succesfully return to main(). The
clever bit is that if you overflow senderName or messageContent and overwrite the saved EIP with a carefully
chosen value, you can actually take control of the program. Now, when processMessage() returns, it no longer
jumps back to ‘j = j + 1;‘, it can jump to any bit of code you want it to.
Advanced Suggestion You can see the contents of the processor’s registers when you pause the program
using the GDB debugger. To do this type info registers (or i r for short) in the debugger command window.
5.2 Determine Offset2 and Offset3
The first thing you need to know is where the saved EBP and EIP are in relation to a known memory address.
If the saved EBP is corrupted the program will crash so the easiest way to find Offset2 is to keep making the
username string longer, 4 bytes at a time, until the program crashes and then look at the length of the string.
Figure 7: Structure of stack within processMessage() - Offset2 is the number of bytes from the start of the
username buffer to the location where EBP is saved. Offset3 is the number of bytes from the start of the
username buffer to the location where EIP is saved and since EBP is a 32bit number, Offset3 = Offset2+4
bytes.
Start with a username string (in main()) that is 69 characters long, this will completely fill the senderName
buffer (including the NULL string terminator, the string is actually 70 bytes long). Make sure the content string
is less than 179 characters long so it doesn’t overflow and cause problems.
Construct your string in a text editor then paste them in to the program so that you can easily add a few
characters at a time, your strings will look something like:
1 |================ 59 Bytes =============|4B=|4B=|4B=| |
2 ˆ=NULL t e rmi n a t o r .
3 Username : xxxxxxxxxx . . . . . . . . . . . . . . . . . . . . . . . . xxxxxxxxAAAABBBB
4 Message : H ell o
Keep adding 4 characters at a time to the username string and re-run the program. When you overwrite
the saved EBP the program will crash.
When the program crashes, compute Offset2. If the program didnt crash last time, but crashed when you
added another 4 bytes your string is now offset2+4 bytes long (including the NULL character)
12 Any 32bit value (such as the saved EBP) is 4 bytes long, therefore Offset3 = Offset2 + 4.
Note: With Code::Blocks and Windows 10, it is not always obvious that the program has crashed. You need
to pay attention to the output from the program, normally you will see something like:
1 P r o c e s s r e t u r n e d 0 ( 0 x0 ) e x e c u ti o n time : 0. 0 1 4 s
2 P r e s s any key t o c o n ti n u e .
If the program crashes, the process will return an error code:
1 P r o c e s s r e t u r n e d =1073741819 ( 0 xC0000005 ) e x e c u ti o n time : 1. 5 3 6 s
2 P r e s s any key t o c o n ti n u e .
5.3 Manually changing the saved EIP value
Now you know Offset3 you are able to modify the saved EIP and change the execution of the program when
processMessage returns. To start with you will do this by adding a line of code in the program that will allow
you to overwrite the saved EIP with a value of your choosing. This isn’t a viable way of exploiting the program
(an attacker wouldnt normally be able to modify and recompile a target program) but it does easily allow you
to understand how changing the saved EIP can affect the program. The EIP value saved on the stack can
be accessed using the following code somewhere in processMessage():
1 * ( ( un si gned i n t *) (&senderName [ 0 ] + O f f s e t 3 ) )
This just says ”I want to access the number located at the memory address ’&senderName[0] + Offset3’ bytes.”.
Obviously you need to substitute in your value for offset3!
5.4 How does changing the saved EIP modify the program’s behaviour?
If you increase the saved EIP, you should be able modify what happens when the program returns from processMessage().
 Normally it would return to the first instruction after the call to processMessage() in main()
(the first j = j+1). If you increase the saved EIP value slightly, processMessage will return to main at a slightly
different point. Notice that there are three j = j + 1 instructions after the call of processMessage(). How much
do you need to increase the saved EIP by to cause the program to skip over one or more of these instructions?
Use:
1 * ( ( un si gned i n t *) (&senderName [ 0 ] + O f f s e t 3 ) ) += 1 ;
to increase the saved EIP by 1 byte, use:
1 * ( ( un si gned i n t *) (&senderName [ 0 ] + O f f s e t 3 ) ) += 2 ;
to increase the saved EIP by 2 bytes etc. You’ll need to increase EIP 1 byte at a time until you manage to
cleanly jump over a j = j + 1 instruction, when you do this the final output of the program will change from:
1 The f i n a l v al u e o f j i s 3
to:
1 The f i n a l v al u e o f j i s 2
The program will crash if you only partially jump over an instruction.
How many bytes do you need to increase the saved EIP by to skip over 1 j = j + 1 instruction?
How many bytes do you need to increase the saved EIP by to skip over 2 j = j + 1 instructions?
How many bytes of memory does a j = j + 1 instruction take up?
Add other, different instructions at the end of main and compute the number of bytes required to jump
them if you want.

SEED-VII 实战指南:如何利用多模态脑电图数据提升情感识别精度 本文提供了SEED-VII多模态脑电图数据集的实战指南,详细介绍了如何利用该数据集提升情感识别精度。内容涵盖数据获取、预处理、特征提取,以及构建多模态融合神经网络模型的关键步骤,并强调了被试者独立评估的重要性,为情感计算研究者提供了从数据到模型的全流程解决方案。 阅读详情

相关推荐

STM32与SD卡SPI接口硬件设计:从原理图到调试的完整指南

SPI(串行外设接口)作为一种广泛应用的同步串行通信协议,以其接线简单、驱动成熟的特点,成为连接微控制器与各类外设的经典方案。其工作原理基于主从架构,通过时钟、数据线和片选信号实现全双工通信,在嵌入式系统中具有极高的技术价值,常用于连接传感器、存储设备和显示模块等。在数据存储场景中,SD卡凭借其大容量和便携性成为首选,而通过SPI模式驱动SD卡,则平衡了性能与设计复杂度。本文聚焦于使用Altium Designer进行硬件设计的工程实践,详细解析了STM32微控制器与SD卡通过SPI通信时,电源管理、上拉电

weixin_34101784的博客 556

the economic & techcrunch

经济学人和techcrunch

Coral_a的博客 532

Ubuntu20.04系统Cuckoo sandbox所需环境搭建及安装(超详细图文)

请勿叫我大神,我只是互联网的搬运工~ 前言 本教程以Ubuntu20桌面版作为示范,服务器版同样适用,但可能稍微麻烦一点,服务器版本的话安装Xmanage套装使用可能会相对轻松一些,由于后面会使用到vbox的使用,对vbox命令行操作不熟悉的小伙伴用xmanage可能会相对轻松一点。 提示:以下是本篇文章正文内容,下面案例可供参考 安装ubuntu20桌面版 步骤1:转到https://ubuntu.com/download/desktop下载下载.iso。 步骤2:使用您选择的虚拟机监控程序(VMWa

ElsonHY的博客 1万+

VMware 安装 SQL Server 双节点 AlwaysOn 可用性组教程 —— WSFC、AG 与侦听器完整部署(系列核心篇)

13_VMware 安装 SQL Server 双节点 AlwaysOn 可用性组教程 —— WSFC、AG 与侦听器完整部署(系列核心篇) 系列定位 :《SQL Server 数据库全栈运维实战系列》第 13 篇,与《MySQL 数据库全栈运维实战系列》同构对标(对标 MySQL 13 主从与 I…

dk843108982的博客 261

UE4_UE5 自定义简单水材质(UE材质图表大全1)

首先是材质的颜色节点、粗糙度节点、透明度节点。(1/2/3/4键+右键空白处,可创建一/二/三/四维节点)接着是两个法线波动节点的叠加。最后是折射节点,将fresnel菲涅尔节点连接到材质结果节点的折射输入端。到这里,你基本已经实现了一个波纹流动的水材质。后续我会更新加上海面浪花的水面材质,可以到我的专栏中寻找。有问题随时私信沟通,加油❤。

shanlinhan的博客 1989

Python Opencv cv2提取图像中某种特定颜色区域(例如黑字白纸背景下的红色公章提取),并将纯色背景透明化

拜拜PHOTOSHOP- 领导突然让我帮他把公章从图片中抠出来,在确保了不是要做坏事的情况下,我打开了PHOTOSHOP,用魔棒工具一点一点抠,但由于魔棒工具的原理是对比临近区域像素差值,导致封闭字体中的区域无法剔除,而且一点一点抠非常麻烦,愤而PYTHON,使用CV2完美解决。 效果如下(马赛克是我添加的): 任务就是把蓝色的公章抠出来。 效果如上。 代码如下: import cv2 import numpy as np src = cv2.imread(r"imagepath")#这里填你的原图像路

qq_43670549的博客 1万+

数据库优化不是只加索引:从 SQL、表结构到写入链路的完整取舍

上线之后,有的查询确实变快,但一段时间之后,写入接口越来越卡、有些 SQL 依旧不走索引、高峰时段锁等待堆积。同时,这条查询只需要 id、order_no、amount,还没有形成覆盖索引,依旧会回表。更新语句的过滤条件,必须能够命中索引,锁定尽可能少的行。有时候 SQL 明明有索引,explain 却看到优化器选择全表扫描,不是索引失效,是 MySQL 统计信息不准,优化器误判扫描行数。如果只有三个单列索引,MySQL 优化器只会选择其中一个索引,剩下的条件需要回表过滤,还需要文件排序,效率很低。

acd12009的博客 144

[原创]Linux 802.11n CSI tool Monitor模式

Linux 802.11n CSI tool Monitor模式 使用AP模式的缺陷在于ping 命令速度比较慢,且不能精确控制发送的参数,比如接收的包数量是不可控的。Monitor模式可以调制发送速率、发包数量、发送天线个数、HT模式、short/long guard interval等等,因此调通Monitor模式是必须的。期间参考了博主沃一德的CSI Tool安装使用讲解,对他的工作表示感...

u014645508的博客 1万+

嵌入式数据库横向对比:HSQLDB · Derby · DuckDB · SQLite · H2 · SQLTiny

SQLTiny 是用 C++20 从零实现的轻量嵌入式数据库,核心定位为支持 MySQL Wire Protocol 的多语言、可网络访问的嵌入式数据库。区别于 SQLite(文件锁)、DuckDB(列式分析)、HSQLDB/H2(私有协议),它以极简代码量(~15k LOC)和标准协议兼容,填补了“嵌入式 + 多语言直连 + TCP server”空白。虽当前性能受限于全局锁与无索引 JOIN,但其清晰架构与生态兼容性使其成为教学、原型开发及多语言项目中理想的 MySQL 替代品。

Life is not divided 273

黑马程序员Pink的javaScript课程APIday4

本文摘要:介绍了JavaScript中日期对象的实例化方法(有参/无参)及三种获取时间戳的方式。讲解了DOM节点操作,包括节点查找(父、子、兄弟节点)、增加/克隆/删除节点的方法。详细说明了移动端touch事件和Swiper插件的使用,包括自动播放和小圆点配置。最后提及学成在线案例中表单验证和取消默认跳转的实现。

JLY19970726的博客 827

【WRF工具】WRF Domain Wizard第一期:软件下载及安装

【WRF工具介绍】WRF Domain Wizard-确定模拟区域

WW、forever的博客 2918

记一次Sql Server2012免费版如何升级到2016企业版本

本文记录了将SQL Server 2012免费版升级至企业版的完整流程,重点解决因版本限制导致无法使用代理功能的问题。通过加载ISO安装包,选择从旧版本升级,完成功能安装与实例配置后,需手动启用“代理XP”并检查服务状态。若代理仍异常,需通过安装程序添加“SQL Server代理”组件,最终实现企业版功能完整启用。

qq_57492774的博客 215

什么是 Agent 的 Context Window?为什么它是 Agent 工程中最核心的约束之一?

什么是 Agent 的 Context Window?为什么它是 Agent 工程中最核心的约束之一?

我哎GIS博客 820

SQL Server 基础语法详解:从建库建表到约束与增删改查

本文以学生信息表 Students 为主线,系统讲解数据库基础语法,涵盖建库、建表、约束添加及增删改查操作。通过 SQL Server T-SQL 示例,清晰区分数据库、表结构与记录的操作对象,强调字段类型、非空、自增、主键、唯一、检查与默认约束的定义与应用,帮助读者理清各语句间的逻辑关系,掌握数据库管理的核心技能。

2601_96519735的博客 1589

数学建模模型总结

这是本人在两年内准备参加数学建模竞赛搜集到的模型资料,已经经过了本人的筛选和整理,希望能够对准备参加数学建模竞赛的学弟学妹们提供一些帮助!

IEM模型,地表粗糙度模拟

利用微波反演土壤水分时候,利用IEM模型可以实现对随机地表的模拟

PostgreSQL 日报| OAuth 校验库置空仍可登录(11 月 9 日)

Tomas Vondra 提交了针对 commit a798660ebe3 中"bogus parameterizations"漏洞的清理版修复补丁,并为各个回退分支分别提供了对应的版本。据报道,OpenAI 正在进行新一轮融资,已额外筹集 110 亿美元,整轮融资尚未正式收官,预计将在未来数周内完成。作为一款面向现代开发流程的 Serverless Postgres 数据库,Lakebase 支持即时分支与环境克隆,并通过计算与存储分离的架构提升性能、降低成本、增强可靠性。函数中发现了一个 bug。

IvorySQL的博客 245

jdk-8u144-linux-x64.tar.gz.

该资源为搭建Linux系统Java环境用,资源的后缀为tar.gz格式的压缩包

#SQLite 数据库笔记一:(概念 / 终端指令 / SQL 语句 / C 编程 / 回调函数)

数据库 = 数据的仓库,假设数据是海量。能力说明存储数据持久化保存,程序退出数据还在统计数据、分组、排序数据管理增、删、改、查(CRUD)嵌入式设备上也会用数据库(单片机网关、路由器、工业 HMI 都常见),因为 sqlite 体积小、无需服务进程、单文件即可。数据库 = 库 > 表 > 记录(行) > 字段(列)sqlite3 = 开源、C 写的、单文件、免安装、最多 2T 的嵌入式关系型数据库。

lwq20051110的博客 260

大中型超市收银系统(可直接运行)

光步前台收银系统系统功能:商品销售、商品退货、挂单、收银员权限、会员销售、单品取消、整单取消、商品查询、脱机销售、脱机数据上传,基本资料下载,开钱箱、小票打印、收款结算,支持多币种付款方式(现金、储值卡、礼券、微信等),支持多种促销。运行环境:.net 4.0登陆信息用户名:1001 密码:123456内置商品信息,商品编码可输入00001000 - 00010000,测试效果相关功能键F5 结算 F9挂单 F11商品查询 F8退货 Insert单品取消 Del整单取消 F12开钱箱F2 会员 Ctrl+Z退出系统 Home 锁屏 相关源码待公开

2026最新PostgreSQL到Doris数据同步完整教程:全流程图形化配置无需写ETL

本文演示通过NineData控制台将PostgreSQL数据实时同步至Apache Doris的完整流程,涵盖结构、全量、增量三阶段复制。全程图形化操作,无需编写脚本,支持键列与分布键可视化映射、复制规格预检查、数据对比校验及延迟告警。适用于构建稳定高效的实时分析数仓,助力报表与大屏查询基于最新数据。

云原生智能数据管理平台 216

1-10 PostgreSQL中多表连接全解:inner/left/right/full/cross join

本文基于 PostgreSQL 15+ 完整拆解 5 种主流连接:内连接、左连接、右连接、全连接、笛卡尔连接。结合可落地的测试数据,演示每种连接的执行逻辑、返回结果,重点剖析 NULL 值对 JOIN 匹配的核心影响,彻底解决多表连接数据丢失、匹配异常、结果错乱的问题。

zhangjw34的专栏 145

DeepSeek总结的 PostgreSQL 18.7、17.12、16.16、15.20、14.25 及 19 RC 2 发布说明

发布于 2026-11-12,由 PostgreSQL 全球开发组发布PostgreSQL 项目 安全PostgreSQL 全球开发组已发布所有受支持版本的更新,包括 18.7、17.12、16.16、15.20 和 14.25,以及 PostgreSQL 19 的第二个发布候选版本。本次发布修复了 52 个安全漏洞和过去几个月报告的 140 多个 bug。有若干问题可能需要你在更新后采取额外步骤,下文有详细说明。请参阅"更新"一节,了解更新后可能需要执行的步骤。完整变更列表请查阅发布说明。

l1t的专栏 266

网站的SQL 注入:从攻击原理到防御措施

SQL 注入(SQL Injection)是 Web 应用中最古老、危害最大的安全漏洞之一。简单来说就是攻击者通过在用户输入中注入了恶意的SQL 代码,让数据库执行非正常的操作,从而能窃取数据、篡改内容甚至控制整个服务器。SQL 注入虽然古老,但至今仍是 Web 安全的头号威胁。永远不要把用户输入直接拼进 SQL 语句。首选:使用 PDO/MySQLi 预处理语句 + 关闭模拟预处理配合:输入类型校验与格式验证加固:数据库最小权限 + 关闭错误回显外围:WAF + 定期安全扫描。

2501_94567985的博客 604

01_SQLServer 体系架构全解 —— 实例进程、关系引擎、SQLOS 与事务日志深入

01_SQLServer 体系架构全解 —— 实例进程、关系引擎、SQLOS 与事务日志深入 系列定位 :《SQL Server 数据库全栈运维实战系列》第 01 篇,与《MySQL 数据库全栈运维实战系列》同构对标(对标 MySQL 01 对应篇目)。 适用版本 :SQL Server 2019/…

dk843108982的博客 1050

SQL Server 增删改查与约束全解:INSERT/UPDATE/DELETE、LIKE 模糊查询、主外键约束

看着简单,但delete和truncate的区别、where漏写、null判断、like通配符、约束命名,每一处都能让新手卡半天。文末给出 WinForm 连接 SQL Server 的完整写法。

2501_94699871的博客 204

快捷键与热键有何异同?

本文对比了热键与快捷键在“粘贴”操作中的异同:用户层面,热键需按Alt+字母组合,快捷键则直接Ctrl+V;开发者层面,修改热键仅需调整菜单标题,而修改快捷键需编辑资源文件中的加速器设置。文章强调专业分工的重要性,并推荐相关排样优化与工具箱技术博文。

闻缺陷则喜何志丹 1778

多数据库开发和管理工具 SQLark,支持达梦/Oceanbase/TiDB/Oracle/MySQL/PG 数据库!

工具选型这个事,没有绝对的优劣,适合自己的工作流最重要。如果你也在用 OceanBase,可以试试 SQLark,至少在连接配置这个环节,确实要省心不少。

零俗 212

PG18 索引与查询特性在 IvorySQL5.6 上的实测

这一篇测 IvorySQL 5.6(PG18) 在索引与查询侧的三组新能力:nbtree 的 skip scan、GIN 索引的并行构建、以及控制文件复制方式的。

IvorySQL的博客 258

SQLServer 索引与 SQL 优化 —— 聚集索引、非聚集索引、覆盖索引、碎片维护与执行计划

11_SQLServer 索引与 SQL 优化 —— 聚集索引、非聚集索引、覆盖索引、碎片维护与执行计划 系列定位 :《SQL Server 数据库全栈运维实战系列》第 11 篇,与《MySQL 数据库全栈运维实战系列》同构对标(对标 MySQL 11 对应篇目)。 适用版本 :SQL Server…

dk843108982的博客 209
上一篇: 6CCS3AIN Pacman MDP Solver
下一篇: CE235 Transposition Cipher
wx____codinghelp
博客等级 码龄2年 771粉丝 115原创
评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

个

红包个数最小为10个

元

红包金额最低5元

当前余额3.43元 前往充值 >
需支付:10.00元
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付元
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值