- 博客(128)
- 收藏
- 关注
转载 [转]简谈高通Trustzone的实现
从trust zone之我见知道,支持trustzone的芯片会跑在两个世界。普通世界、安全世界,对应高通这边是HLOS,QSEE。如下图:如下是HLOS与QSEE的软件架构图HLOS这两分为kernel层,user层。user层的通过qseecom提供的API起动trustzone那边的app。qseecom driver 除了提供API,还调用scm函数做世界切换。scm driver 那边接...
2018-06-06 15:59:11
2060
原创 memcpy_s 的安全提示
errno_t memcpy_s( void *restrict dest, rsize_t destsz, const void *restrict src, rsize_t count );(2)(since C11) 1) Copies count characters from the
2018-04-25 16:31:39
5140
原创 发现一个安全牛人的博客, mark 一下
http://blog.youkuaiyun.com/ioio_jy?viewmode=contents
2017-05-16 11:05:46
852
原创 integer overflow to buffer overflow --- 例子
看下面的例子:unsigned int a ;unsigned int b;int *ptr = (int *)malloc(a+b);memcpy(ptr, buf, a);有可能 a+b 发生 integer overflow, 导致 ptr 申请到比较小的内存区域,memcpy 的时候发生溢出。
2017-05-16 10:47:46
1095
原创 intel-amt-vulnerability-- memcmp and strncmp function calls can be skipped due to incorrect buffer l
原文如下:https://www.embedi.com/news/what-you-need-know-about-intel-amt-vulnerability攻击原理如下:As the paper describes, the code checks user response as: if(strncmp(computed_respon
2017-05-15 16:08:30
745
转载 cwe ---Improper Restriction of Excessive Authentication Attempts
http://cwe.mitre.org/data/definitions/307.html#Demonstrative%20ExamplesDescription SummaryThe software does not implement sufficient measures to prevent multiple failed authentication
2017-05-10 16:53:06
681
原创 CWE -- Incorrect Calculation of Buffer Size
http://cwe.mitre.org/data/definitions/131.html#Demonstrative%20ExamplesDemonstrative ExamplesExample 1The following code allocates memory for a maximum number of widgets. It then g
2017-05-10 16:47:48
537
原创 如何解决 a+b >c 和 a*b 和 a-b 的 integer overflow 问题
注: a 和 b 都是 int 型 的。To create a conforming program you need to test for overflowbefore generating said overflow. The method can be used with unsigned integers too// for addition#include
2017-05-10 11:18:31
916
转载 CWE -- 不要误用 sizeof (pointer) -- 例子
原文地址:https://cwe.mitre.org/data/definitions/467.htmlDescription SummaryThe code calls sizeof() on a malloced pointer type, which always returns the wordsize/8. This can produce a
2017-05-09 16:49:38
2538
转载 CWE -- memory or buffer overflow --- 例子
原文链接:https://cwe.mitre.org/data/definitions/119.htmlDescriptionDescription SummaryThe software performs operations on a memory buffer, but it can read from or write to a memory l
2017-05-09 16:15:47
865
转载 CWE --- NULL Pointer Dereference -- 例子
原文地址:https://cwe.mitre.org/data/definitions/476.htmlDescription SummaryA NULL pointer dereference occurs when the application dereferences a pointer that it expects to be valid,
2017-05-09 15:25:02
2662
原创 CWE -- Out-of-bounds Write 例子
原文地址:https://cwe.mitre.org/data/definitions/787.html1. 什么是 out-of-bound write Description SummaryThe software writes data past the end, or before the beginning, of the intended bu
2017-05-09 13:09:11
1575
原创 CWE --- Time-of-check Time-of-use (TOCTOU) 例子 和 mitigation
原文地址:https://cwe.mitre.org/data/definitions/367.htmlExample 1The following code checks a file, then updates its contents.(Bad Code)Example Languages: C and C++
2017-05-09 11:45:10
3528
原创 copy_from_user 和 toctou
copy_from_user 是把数据从用户空间 copy 到 内核空间。 driver 先 把数据从用户空间copy 到内核空间,然后再进行 check. 因为如果数据在user 空间 check 之后再copy 到内核,check 后到copy 之间的时间,数据有可能会被改变。参见TOCTOU 问题。 所以把数据 copy 到 内核空间,内核空间不太容
2017-05-03 15:26:04
754
原创 secure boot 的知识
ARM TrustZone 使用这种boot方式。1. 什么是 secure boot?5.2.2. Secure bootA secure boot scheme adds cryptographic checks to each stage of the Secure world boot process. This process aims to
2017-05-03 12:58:16
7632
原创 Linux中环境变量文件及配置
Linux中环境变量包括系统级和用户级,系统级的环境变量是每个登录到系统的用户都要读取的系统变量,而用户级的环境变量则是该用户使用系统时加载的环境变量。所以管理环境变量的文件也分为系统级和用户级的,下面贴一个网上找到的讲的比较明白的文件介绍(略作修改)[1]:1.系统级:(1)/etc/profile:该文件是用户登录时,操作系统定制用户环境时使用的第一个文件,应用于登录到系统的每
2017-04-26 16:23:26
319
转载 Makefile 中:= ?= += =的区别
在Makefile中我们经常看到 = := ?= +=这几个赋值运算符,那么他们有什么区别呢?我们来做个简单的实验新建一个Makefile,内容为:ifdef DEFINE_VRE VRE = “Hello World!”elseendififeq ($(OPT),define) VRE ?= “Hello World! First!”
2017-04-26 15:33:21
271
原创 整型提升(integer promotion)
什么是integer promotion:Integer PromotionsInteger types smaller than int are promoted when an operation is performed on them. If all values of the original type can be represented as anin
2017-04-25 14:58:22
1612
原创 线程安全 thread safe
什么是线程安全:The first class of approaches focuses on avoiding shared state, and includes:Re-entrancy Writing code in such a way that it can be partially executed by a thread, reexecuted by t
2017-04-20 15:54:07
922
转载 ret2plt 介绍
转自:http://blog.youkuaiyun.com/linyt/article/details/47429823背景前面介绍ret2libc攻击技术,原理很简单,只需要将system函数的地址填充到eip的位置,然后再把”/bin/bash”地址填充到eip + 8的位置即可以实现攻击。很快安全专家提出了ASCII armoring保护机制。该方
2017-04-18 13:43:02
2949
转载 Heap Spray
Heap Spray 定义基本描述Heap Spray 并没有一个官方的正式定义,毕竟这是漏洞攻击技术的一部分。但是我们可以根据它的特点自己来简单总结一下。 Heap Spray 是在 shellcode 的前面加上大量的 slide code (滑板指令),组成一个注入代码段。然后向系统申请大量内存,并且反复用注入代码段来填充。这样就使得进程的地址空间被大量的注入代码所占据。然后结合其他
2017-04-17 15:13:35
1134
转载 format string attack
下面的这两篇文章都讲得很好:https://www.exploit-db.com/docs/28476.pdfhttp://codearcana.com/posts/2013/05/02/introduction-to-format-string-exploits.html现将上文的第二篇文章摘录如下:How do format string
2017-03-30 11:26:10
2576
原创 trust boundary violation
这个violation 形成的原因,就是mix use trusted and untrusted data in the same data structure. 14. Trust Boundary ViolationDescription: Web applications often mistakenly mix trusted and untrusted da
2017-03-29 14:01:42
8916
原创 Integer Promotion
Almost every programmer has learned about C, and a lot of them use it for their career. Yet, C can be really tricky and behave unexpectedly sometimes. One of those dodgy side of C is integer promot
2017-03-29 10:57:24
899
转载 toctou race condition
说的比较好的文章在这里:http://www.cis.syr.edu/~wedu/Teaching/IntrCompSec/LectureNotes_New/Race_Condition.pdfTOCTOU: time of check - time of use攻击发生在 check 和 use 之间。具体的 countermeasure 在上面提到
2017-03-28 15:03:45
1869
1
原创 UAF (use after free) 漏洞
Use After Free 如上代码所示,指针p1申请内存,打印其地址,值然后释放p1指针p2申请同样大小的内存,打印p2的地址,p1指针指向的值Gcc编译,运行结果如下: p1与p2地址相同,p1指针释放后,p2申请相同的大小的内存,操作系统会将之前给p1的地址分配给p2,修改p2的值,p1也被修改了。由此我们可以知道:1.在f
2017-03-22 11:25:53
4557
原创 Linux 堆溢出 分析
1. Linux堆管理算法 Linux系统通过glibc程序库提供堆内存管理功 能,存在两种堆管理算法. glibc2.2.4及以下版本是使用Doug Lea的实现方法 tcmalloc . glibc2.2.5及以上版本采用了Wolfram Gloger的 ptmalloc/ptmalloc2代码。ptmalloc2代码是从 Doug Lea
2017-03-21 16:52:17
2242
原创 stack canary 的认识
在前面的博客里面,已经介绍了 stack overflow 的攻击原理,其中也设计到了 GCC 编译器的 stack canary 技术,用于预防 stack overflow.现在再来详细了解一下stack canaries 的种类,已经他们的作用吧。如果能在运行时检测出 stack overflow 破坏,就有可能对函数栈进行保护。目前的堆栈保护实现大多使用基于 “Cana
2017-03-15 11:33:48
9226
转载 什么是 shellcode
缓冲区溢出的攻击思路已经很清晰了:首次是找到对准EIP的位置,然后覆盖 EIP跳到注入的shellcode 里执行。前面例子只是简单展示了shellcode长什么样子,事实上shellcode是攻击的核心所在。漏洞触发后执行的操作完全由shellcode来决定,因此学会编写shellcode是黑客的基本功。下面从Wiki摘录这来的定义:In computer s
2017-03-14 16:07:09
5769
原创 ROP攻击技术
原文地址:http://blog.youkuaiyun.com/linyt/article/details/48738757背景前面介绍了ret2libc和ret2plt,这两个攻击技术的相通点是函数参数是通过压栈来传递,这也是i386架构的调用约定。然而随着64位服务器的普及,以及后来越来越广泛,以致几乎所有服务器都升级到64位的硬件上。x86
2017-03-14 14:58:03
5037
1
原创 Ret2Libc 攻击技术
1. DEP 技术对stack overflow 的保护:Data Execution Prevention: 去掉 stack 上的执行权限,可以阻止一部分基于 stack 的攻击。 2. Ret2Libc 攻击原理 Return-to-library technique 简称“Ret2Lib”,这种技术可以绕过DEP的保护,其核心思想是把
2017-03-13 17:00:11
5733
原创 栈溢出漏洞及栈溢出攻击
1. 栈溢出的原因栈溢出(stack-based buffer overflows)算是安全界常见的漏洞。一方面因为程序员的疏忽,使用了 strcpy、sprintf 等不安全的函数,增加了栈溢出漏洞的可能。另一方面,因为栈上保存了函数的返回地址等信息,因此如果攻击者能任意覆盖栈上的数据,通常情况下就意味着他能修改程序的执行流程,从而造成更大的破坏。这种攻击方法就是栈溢出攻击(stack
2017-03-13 16:38:14
12988
原创 25 simple examples of Linux find command
Basic examples1. List all files in current and sub directoriesThis command lists out all the files in the current directory as well as the subdirectories in the current directory.$ find../
2017-03-08 11:01:03
409
原创 分享一个 变量没有初始化 可能带来的问题
先看 code:static void do_ctors_aux(void){ /* SGX RTS does not support .ctors currently */ fp_t *p = NULL; uintptr_t init_array_addr; size_t init_array_size; const void *en
2017-02-22 11:54:05
1613
原创 sbrk() 函数是干什么的?
brk和sbrk主要的工作是实现虚拟内存到内存的映射.在GNU C中,内存分配是这样的: 每个进程可访问的虚拟内存空间为3G,但在程序编译时,不可能也没必要为程序分配这么大的空间,只分配并不大的数据段空间,程序中动态分配的空间就是从这一块分配的。如果这块空间不够,malloc函数族(realloc,calloc等)就调用sbrk函数将数据段的下界移动,sbrk函数在内核的
2017-02-21 13:47:23
14711
原创 关于stack 以及相关的寄存器的知识(x86 结构)
1. stack 通常是从高地址到低地址增长的。2. EBP: base pointer. ESP: stack pointer. EBP 指向stack 的基址。 ESP: 总是指向 stack 的顶端。3. 下面以一个函数调用为例来讲解函数调用过程: #include
2017-02-16 16:54:25
902
原创 Linux kernel 的source code 官网
google 搜索 linux kernel , 官网是:https://www.kernel.org/可以把 kernel download 下来, 也可以在线看。如果在线浏览某个版本的source code, 则点击 "brownse " 进行。
2017-01-23 15:52:33
1827
原创 RED HAT 防火墙服务firewalld
对于CentOS/RHEL 7或Fedora 18以上版本的系统,使用FirewallD服务来配置防火墙。FirewallD即Dynamic Firewall Manager of Linux systems,Linux系统的动态防火墙管理器。FirewallD是一个服务,用于配置网络连接,从而哪些内外部网络的数据包可以允许穿过网络或阻止穿过网络。防火墙栈的整体图如
2017-01-23 15:28:10
1555
原创 linux grub.cnf grub64.efi 文件
在 ubuntu 14.04 和 Red Hat 7.2 系统中,如果系统是EFI 启动的,那么在 /boot/efi/EFI/ 目录下有 grub64.efi 和 grub.cnf 文件。grub64.efi 是EFI启动文件grub.conf 是配置文件
2017-01-22 16:43:36
2243
原创 Security -- Format string attack
DescriptionThe Format String exploit occurs when the submitted data of an input string is evaluated as a command by the application. In this way, the attacker could execute code, read the stack,
2016-12-09 10:18:22
834
空空如也
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人