Trusted computing technology has been introduced to build a secure cloud infrastructure, which can improve the dilemma of software security. However, traditional trusted hardware technology does not provide sufficient protection for runtime security for cloud. To solve this problem, a UEFI based dynamic security framework for virtual machine, named VirtinSpector, was proposed. The VirtinSpector treated UEFI firmware as a trusted computing base to acquire a run-time and dynamic security measurement for cloud, providing a dynamic protection out of traditional solution. And a prototype of VirtinSpector for the Xen hypervisor was implemented. The experiments showed that the framework can measure and explore some mainstream attacks of cloud, and its performance payload is restricted whining an acceptable range, without affecting the user’s daily use.