WO2019080660A1 - 一种模型训练方法、检测url的方法及装置 - Google Patents

一种模型训练方法、检测url的方法及装置

Info

Publication number
WO2019080660A1
WO2019080660A1 PCT/CN2018/105176 CN2018105176W WO2019080660A1 WO 2019080660 A1 WO2019080660 A1 WO 2019080660A1 CN 2018105176 W CN2018105176 W CN 2018105176W WO 2019080660 A1 WO2019080660 A1 WO 2019080660A1
Authority
WO
WIPO (PCT)
Prior art keywords
parameter
url
feature vector
model
isolated forest
Prior art date
Application number
PCT/CN2018/105176
Other languages
English (en)
French (fr)
Inventor
张雅淋
李龙飞
Original Assignee
阿里巴巴集团控股有限公司
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by 阿里巴巴集团控股有限公司 filed Critical 阿里巴巴集团控股有限公司
Publication of WO2019080660A1 publication Critical patent/WO2019080660A1/zh

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F21/00Security arrangements for protecting computers, components thereof, programs or data against unauthorised activity
    • G06F21/50Monitoring users, programs or devices to maintain the integrity of platforms, e.g. of processors, firmware or operating systems
    • G06F21/55Detecting local intrusion or implementing counter-measures
    • G06F21/56Computer malware detection or handling, e.g. anti-virus arrangements
    • G06F21/566Dynamic detection, i.e. detection performed at run-time, e.g. emulation, suspicious activities
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F18/00Pattern recognition
    • G06F18/20Analysing
    • G06F18/21Design or setup of recognition systems or techniques; Extraction of features in feature space; Blind source separation
    • G06F18/214Generating training patterns; Bootstrap methods, e.g. bagging or boosting
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F18/00Pattern recognition
    • G06F18/20Analysing
    • G06F18/24Classification techniques
    • G06F18/243Classification techniques relating to the number of classes
    • G06F18/24323Tree-organised classifiers
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F21/00Security arrangements for protecting computers, components thereof, programs or data against unauthorised activity
    • G06F21/50Monitoring users, programs or devices to maintain the integrity of platforms, e.g. of processors, firmware or operating systems
    • G06F21/51Monitoring users, programs or devices to maintain the integrity of platforms, e.g. of processors, firmware or operating systems at application loading time, e.g. accepting, rejecting, starting or inhibiting executable software based on integrity or source reliability
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L63/00Network architectures or network communication protocols for network security
    • H04L63/14Network architectures or network communication protocols for network security for detecting or protecting against malicious traffic
    • H04L63/1408Network architectures or network communication protocols for network security for detecting or protecting against malicious traffic by monitoring network traffic
    • H04L63/1425Traffic logging, e.g. anomaly detection
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L63/00Network architectures or network communication protocols for network security
    • H04L63/14Network architectures or network communication protocols for network security for detecting or protecting against malicious traffic
    • H04L63/1441Countermeasures against malicious traffic
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F2221/00Indexing scheme relating to security arrangements for protecting computers, components thereof, programs or data against unauthorised activity
    • G06F2221/21Indexing scheme relating to G06F21/00 and subgroups addressing additional information or applications relating to security arrangements for protecting computers, components thereof, programs or data against unauthorised activity
    • G06F2221/2119Authenticating web pages, e.g. with suspicious links

Definitions

  • the present specification relates to the field of information technology, and in particular, to a model training method, a method and a device for detecting a URL.
  • the person responsible for network security usually sets some security rules based on business experience (for example, the URL containing the XX field cannot pass the detection), so that the server detects whether the received URL meets the security rules and only complies with the security rules.
  • the URL is parsed to avoid being attacked.
  • the embodiment of the present specification provides a model training method, a method and a device for detecting a URL, so as to solve the problem that the method for detecting a URL is not high in security.
  • An isolated forest Isolation Forest model is constructed according to the feature vectors corresponding to the respective parameters, and the isolated forest model is used to detect whether the URL is abnormal.
  • the feature vectors corresponding to the respective parameters are input to a pre-built isolated forest model to perform anomaly detection on the URL; and the isolated forest model is constructed according to the above model training method.
  • the processing module constructs an isolated forest model according to the feature vectors corresponding to the respective parameters, and the isolated forest model is used to detect whether the URL is abnormal.
  • the abnormality detecting module inputs the feature vector corresponding to each parameter into a pre-built isolated forest Isolation Forest model to perform anomaly detection on the URL; and the isolated forest model is constructed according to the above model training method.
  • a model training device provided by an embodiment of the present specification includes one or more processors and a memory, the memory stores a program, and is configured to perform the following steps by the one or more processors:
  • An isolated forest model is constructed according to the feature vectors corresponding to the respective parameters, and the isolated forest model is used to detect whether the URL is abnormal.
  • An apparatus for detecting a URL comprising one or more processors and a memory, the memory stores a program, and is configured to perform the following steps by the one or more processors:
  • the feature vectors corresponding to the respective parameters are input to a pre-built isolated forest model to perform anomaly detection on the URL; and the isolated forest model is constructed according to the above model training method.
  • a plurality of URLs are obtained, parameters in each URL are determined, and feature vectors corresponding to each parameter are obtained, and then corresponding feature vectors are respectively selected according to each parameter.
  • build an isolated forest model The isolated forest model can be used to detect if the URL is abnormal.
  • anomalous URLs are often URLs sent by hackers, and the server can refuse to resolve unusual URLs from hacking.
  • 2a-c are schematic diagrams showing the distribution of normal points and abnormal points provided by the embodiments of the present specification
  • FIG. 3 is a flowchart of a method for detecting a URL according to an embodiment of the present disclosure
  • FIG. 4 is a schematic diagram of a model training device provided by an embodiment of the present specification.
  • FIG. 5 is a schematic diagram of an apparatus for detecting a URL according to an embodiment of the present disclosure
  • FIG. 6 is a schematic diagram of a model training device provided by an embodiment of the present specification.
  • FIG. 7 is a schematic diagram of an apparatus for detecting a URL according to an embodiment of the present disclosure.
  • the existing method of detecting a URL is to detect the URL by the server according to a manually established security rule.
  • the means by which hackers use URLs for cyber attacks are ever-changing.
  • Manually-defined security rules are difficult to cover all attack methods.
  • artificially-defined security rules usually lag behind emerging attacks.
  • a plurality of URLs are acquired, parameters in each URL are extracted, and feature vectors corresponding to each parameter are determined, and an isolation forest Isolation Forest is constructed according to the feature vectors corresponding to the respective parameters. model.
  • the isolated forest model is an anomaly detection model. The isolated forest model can detect whether a certain URL is abnormal, and the abnormal URL is often the URL sent by the hacker, and the server can refuse to parse the exception. URL to avoid being hacked.
  • the isolated forest model can be constructed according to the feature vector corresponding to the parameters in several URLs, because in practice, the main means for the hacker to attack the server by using the URL is to add an illegal field in the parameter of the URL. That is to say, there is a significant difference between the feature vector of the parameter in the normal URL and the feature vector of the parameter in the abnormal URL.
  • the characteristics of the parameters in the anomalous URL are often rare, distinct from the characteristics of the parameters in the normal URL.
  • the core idea of the technical solution described in the present specification is to construct an isolated forest model by using feature vectors of parameters in a plurality of known URLs as data samples.
  • the isolated forest model can determine whether the URL is abnormal according to the feature vector of the parameter in the URL to be detected.
  • FIG. 1 is a flowchart of a model training method provided by an embodiment of the present specification, including the following steps:
  • the execution subject may be a server or other device having data processing capability.
  • the execution subject is a server as an example.
  • the parameters in the URL can contain some information entered by the user (possibly a hacker).
  • URL can contain more than one parameter. Different parameters are usually separated by "&". Each parameter has a parameter name and a parameter value. Parameter values are usually entered by the user.
  • the SQL injection attack can be used to send the following abnormal URL to the server:
  • a plurality of URLs acquired by the server generally include a partial normal URL and a partially abnormal URL. Since the abnormal URL is rare, it has a lower proportion in the several URLs.
  • the parameter in the server extraction URL may be a parameter name and a parameter value included in the extraction URL, or may be a parameter value that only extracts parameters in the URL.
  • the server may extract all the parameters in the URL for each URL, and may also extract some parameters in the URL.
  • the server may determine, for each URL, a parameter whose parameter name satisfies the specified condition among the parameters included in the URL; and extract the parameter value of the parameter for each parameter determined.
  • the specified condition may be that the probability of occurrence of the parameter name is greater than the specified probability value.
  • S104 Determine, for each parameter extracted, a feature vector corresponding to the parameter.
  • an N-dimensional feature vector corresponding to the parameter may be determined according to the parameter value of the parameter for each parameter extracted; N is a natural number greater than 0.
  • the dimension corresponding to the feature vector of the parameter may include the total number of characters included in the parameter value of the parameter, the total number of letters, the total number of digits, the total number of specific symbols, the number of different characters, the number of different letters, the number of different numbers, and the number of different specific symbols. At least one of them.
  • the parameter value of the parameter name1 in the URL is user1.
  • the value of the parameter contains 5 characters, 4 letters, and 1 total number.
  • the total number of specific symbols is 0, the number of different characters is 5, the number of different letters is 4, the number of different numbers is 1, and the number of different specific symbols is 0.
  • the feature vector corresponding to the parameter name1 may be (5, 4, 1, 0, 5, 4, 1, 0).
  • each dimension of the feature vector can be normalized.
  • the eight feature vector values corresponding to the parameter name1 are normalized.
  • x represents the feature vector value
  • z represents the total number of characters contained in the parameter name1
  • y represents the value constructed by normalizing x.
  • the parameter name1 contains the feature vector vector (5/5, 4/5, 1/5, 0/5, 5/5, 4/5, 1/5, 0/5), ie (1, 0.8, 0.2, 0, 1, 0.8, 0.8, 0).
  • S106 Construct an isolated forest model according to the feature vectors corresponding to the respective parameters.
  • the isolated forest algorithm is constructed, and the isolated forest model is constructed according to the feature vectors corresponding to the respective parameters, and the isolated forest model is used to detect whether the URL is abnormal. There is no need to mark the normal or abnormality of the feature vector corresponding to each parameter.
  • hollow points and solid points are included in the 10 points shown in FIG. 2a, and the number of hollow points is large (8), and the distribution is concentrated, and the number of solid points is small (2). And the distribution is more dispersed.
  • a hollow point can be considered a normal point, and a solid point can be regarded as an abnormal point. In other words, the anomaly point is a small number of outliers. Then do the following:
  • Fig. 2a appears randomly, and the points in Fig. 2a are divided into part A and part B, and Fig. 2b is obtained.
  • the second division for the A part, continue to randomly appear a line, the points in the A part are divided into C part and D part; similarly, for the B part, a line appears randomly, and the point in the B part is divided into E Part and Part F, as shown in Figure 2c.
  • each part contains only 1 point, that is, each point is divided into a dedicated part (If a part contains only one point, this part is the exclusive part of this point).
  • the solid point is easier and faster to be assigned to the exclusive part.
  • Part F the exclusive part
  • S classification trees specifically, binary trees.
  • the points shown in Figure 2a are placed in the root node, starting from the root node.
  • the condition of a bifurcation is random (ie, each time it is divided by a randomly occurring line-to-point), in which the earlier the point of falling into the leaf node, the higher the probability of anomalies.
  • a tree forest model is constructed based on the feature vectors corresponding to the respective parameters in step S106.
  • the isolated forest includes S binary trees (iTree). For each iTree, the process of training the iTree can be described as follows:
  • each feature vector M feature vectors are randomly selected and placed in the root node of the iTree;
  • a dimension (specified dimension) is randomly assigned, and in the value of the specified dimension, a value is randomly assigned as a cut value; the cut value is between M Between the maximum and minimum values in the value of the specified dimension of the feature vector;
  • the M feature vectors are divided into two parts, and the feature vector of the specified dimension is not less than a part of the cut value, and the value of the specified dimension is smaller than the cut value. portion;
  • the second step and the third step are performed recursively until the iTree reaches the specified height or only the feature vector is placed on the leaf node of the iTree.
  • the specified height can be set as needed, generally log2M.
  • M feature vectors may be randomly selected in all feature vectors, or M feature vectors may be randomly selected in the unselected feature vectors.
  • FIG. 3 is a flowchart of a method for detecting a URL according to an embodiment of the present disclosure, including the following steps:
  • S304 Determine, for each parameter extracted, a feature vector corresponding to the parameter.
  • S306 Input a feature vector corresponding to each parameter into a pre-built isolated forest model to perform anomaly detection on the URL.
  • the URL in Figure 3 is the URL to be detected.
  • steps S300 to S304 refer to steps S100 to S104, and details are not described herein.
  • step S306 the feature vectors corresponding to the respective parameters may be input to the isolated forest model, and the model output results corresponding to the respective parameters may be obtained, and whether the abnormal parameters exist in each parameter may be determined according to the model output results corresponding to the respective parameters.
  • the feature vector corresponding to the parameter may be input to the isolated forest model, so as to classify the feature vector corresponding to the parameter by using each classification tree in the isolated forest model, and determine the feature corresponding to the parameter.
  • the average height of the leaf nodes that the vector falls in each classification tree is used as the model output result corresponding to the parameter; then, for each parameter, if the model output result corresponding to the parameter is less than the specified threshold, the parameter is determined to be abnormal. If the model output result corresponding to the parameter is not less than the specified threshold, it is determined that the parameter is normal; when any parameter is determined to be abnormal, the parameter having an abnormality in each parameter is determined; when it is determined that each parameter is normal, then each parameter is determined. There are no abnormal parameters.
  • the isolated forest model is constructed according to the feature vector of the parameter in the URL, so that the server can detect the received URL by isolating the forest model, and if it is determined that the received URL is abnormal, Refuse to parse the URL to avoid being hacked and improve network security.
  • potential cyber attack means can also be found. Specifically, by isolating the forest model, it can be determined whether a certain URL is abnormal. If the URL is abnormal, it means that the parameter value of the parameter is abnormal, and the abnormal parameter value can prompt the staff to analyze the attack means used by the hacker. Facilitate staff to improve safety rules.
  • the embodiment of the present specification further provides a model training device, as shown in FIG. 4 , including:
  • the obtaining module 401 is configured to obtain a plurality of uniform resource locator URLs
  • the extracting module 402 extracts parameters in the URL for each URL
  • a determining module 403 for each parameter extracted, determining a feature vector corresponding to the parameter
  • the processing module 404 constructs an isolated forest model according to the feature vectors corresponding to the respective parameters, and the isolated forest model is used to detect whether the URL is abnormal.
  • the extracting module determines, for each URL, a parameter whose parameter name satisfies a specified condition among the parameters included in the URL; and extracts a parameter value of the parameter for each parameter determined.
  • the determining module determines, for each parameter extracted, an N-dimensional feature vector corresponding to the parameter according to the parameter value of the parameter; N is a natural number greater than 0.
  • the dimension of the N-dimensional feature vector includes: the total number of characters included in the parameter value of the parameter, the total number of letters, the total number of digits, the total number of symbols, the number of different characters, the number of different letters, the number of different numbers, and the number of different symbols.
  • the embodiment of the present specification further provides a device for detecting a URL, as shown in FIG. 5, including:
  • Obtaining module 501 obtaining a URL
  • Extracting module 502 extracting parameters in the URL
  • a determining module 503 for each parameter extracted, determining a feature vector corresponding to the parameter;
  • the abnormality detecting module inputs the feature vector corresponding to each parameter into a pre-built isolated forest Isolation Forest model to perform anomaly detection on the URL; and the isolated forest model is constructed according to the above model training method.
  • the abnormality detecting module inputs the feature vector corresponding to each parameter into a pre-built isolated forest Isolation Forest model, and constructs a model output result corresponding to each parameter; and according to the model output result corresponding to each parameter, it is determined whether each parameter is There is an abnormal parameter; if so, it is determined that the URL is abnormal; otherwise, it is determined that the URL is normal.
  • the anomaly detection module inputs, for each parameter, a feature vector corresponding to the parameter to a pre-built isolated forest model, to classify the feature vector corresponding to the parameter by using each classification tree in the isolated forest model, and determining The average height of the leaf nodes that the feature vector corresponding to the parameter falls in each classification tree is used as the model output result corresponding to the parameter; for each parameter, if the model output result corresponding to the parameter is less than the specified threshold, then the The parameter is abnormal. If the model output result corresponding to the parameter is not less than the specified threshold, it is determined that the parameter is normal.
  • the embodiment of the present specification further provides a model training device, as shown in FIG. 6, including one or more processors and a memory, the memory stores a program, and is configured. The following steps are performed by the one or more processors:
  • An isolated forest Isolation Forest model is constructed according to the feature vectors corresponding to the respective parameters, and the isolated forest model is used to detect whether the URL is abnormal.
  • the embodiment of the present specification further provides a device for detecting a URL, as shown in FIG. 7, including one or more processors and a memory, where the memory stores a program, and Configuring to perform the following steps by the one or more processors:
  • the feature vectors corresponding to the respective parameters are input to a pre-built isolated forest Isolation Forest model to perform anomaly detection on the URL; the isolated forest model is constructed according to the above model training method.
  • PLD Programmable Logic Device
  • FPGA Field Programmable Gate Array
  • HDL Hardware Description Language
  • the controller can be implemented in any suitable manner, for example, the controller can take the form of, for example, a microprocessor or processor and a computer readable medium storing computer readable program code (eg, software or firmware) executable by the (micro)processor.
  • computer readable program code eg, software or firmware
  • examples of controllers include, but are not limited to, the following microcontrollers: ARC 625D, Atmel AT91SAM, The Microchip PIC18F26K20 and the Silicone Labs C8051F320, the memory controller can also be implemented as part of the memory's control logic.
  • the controller can be logically programmed by means of logic gates, switches, ASICs, programmable logic controllers, and embedding.
  • Such a controller can therefore be considered a hardware component, and the means for implementing various functions included therein can also be considered as a structure within the hardware component.
  • a device for implementing various functions can be considered as a software module that can be both a method of implementation and a structure within a hardware component.
  • the system, device, module or unit illustrated in the above embodiments may be implemented by a computer chip or an entity, or by a product having a certain function.
  • a typical implementation device is a computer.
  • the computer can be, for example, a personal computer, a laptop computer, a cellular phone, a camera phone, a smart phone, a personal digital character assistant, a media player, a navigation device, an email device, a game console, a tablet computer, a wearable device. Or a combination of any of these devices.
  • embodiments of the present invention can be provided as a method, system, or computer program product. Accordingly, the present invention may take the form of an entirely hardware embodiment, an entirely software embodiment, or a combination of software and hardware. Moreover, the invention can take the form of a computer program product embodied on one or more computer-usable storage media (including but not limited to disk storage, CD-ROM, optical storage, etc.) including computer usable program code.
  • computer-usable storage media including but not limited to disk storage, CD-ROM, optical storage, etc.
  • the computer program instructions can also be stored in a computer readable memory that can direct a computer or other programmable data processing device to operate in a particular manner, such that the instructions stored in the computer readable memory produce an article of manufacture comprising the instruction device.
  • the apparatus implements the functions specified in one or more blocks of a flow or a flow and/or block diagram of the flowchart.
  • These computer program instructions can also be loaded onto a computer or other programmable data processing device such that a series of operational steps are performed on a computer or other programmable device to produce computer-implemented processing for execution on a computer or other programmable device.
  • the instructions provide steps for implementing the functions specified in one or more of the flow or in a block or blocks of a flow diagram.
  • a computing device includes one or more processors (CPUs), input/output interfaces, network interfaces, and memory.
  • processors CPUs
  • input/output interfaces network interfaces
  • memory volatile and non-volatile memory
  • the memory may include non-persistent memory, random access memory (RAM), and/or non-volatile memory in a computer readable medium, such as read only memory (ROM) or flash memory.
  • RAM random access memory
  • ROM read only memory
  • Memory is an example of a computer readable medium.
  • Computer readable media includes both permanent and non-persistent, removable and non-removable media.
  • Information storage can be implemented by any method or technology.
  • the information can be computer readable instructions, data structures, modules of programs, or other data.
  • Examples of computer storage media include, but are not limited to, phase change memory (PRAM), static random access memory (SRAM), dynamic random access memory (DRAM), other types of random access memory (RAM), read only memory. (ROM), electrically erasable programmable read only memory (EEPROM), flash memory or other memory technology, compact disk read only memory (CD-ROM), multi-character versatile disc (DVD) or other optical storage
  • PRAM phase change memory
  • SRAM static random access memory
  • DRAM dynamic random access memory
  • RAM random access memory
  • ROM read only memory
  • EEPROM electrically erasable programmable read only memory
  • flash memory or other memory technology
  • compact disk read only memory CD-ROM
  • DVD multi-character versatile disc
  • embodiments of the present specification can be provided as a method, system, or computer program product. Accordingly, the present description may take the form of an entirely hardware embodiment, an entirely software embodiment or an embodiment in combination of software and hardware. Moreover, the description may take the form of a computer program product embodied on one or more computer-usable storage media (including but not limited to disk storage, CD-ROM, optical storage, etc.) including computer usable program code.
  • computer-usable storage media including but not limited to disk storage, CD-ROM, optical storage, etc.
  • program modules include routines, programs, objects, components, data structures, and the like that perform particular tasks or implement particular abstract data types.
  • the present specification can also be practiced in distributed computing environments where tasks are performed by remote processing devices that are connected through a communication network.
  • program modules can be located in both local and remote computer storage media including storage devices.

Abstract

本说明书实施例公开了一种模型训练方法、检测URL的方法及装置。在本说明书实施例中,获取若干URL,确定每个URL中的参数,并得到每个参数对应的特征向量,然后根据各参数分别对应的特征向量,构建隔绝森林模型。

Description

一种模型训练方法、检测URL的方法及装置 技术领域
本说明书涉及信息技术领域,尤其涉及一种模型训练方法、检测URL的方法及装置。
背景技术
在互联网时代,网络安全尤其重要。黑客常常利用网络安全漏洞,通过统一资源定位符(Uniform Resoure Locator,URL)侵入到服务器,进行诸如结构化查询语言(Structured Query Language,SQL)注入攻击、跨站脚本攻击等非法操作。以SQL注入攻击为例,黑客可以在URL的参数中添加非法字段,使得服务器在对接收到URL进行解析时,将非法字段误认为可执行代码而执行,威胁服务器上的数据安全。
在实际应用中,负责网络安全的人员通常基于业务经验,设置一些安全规则(例如,包含XX字段的URL不能通过检测),使得服务器检测接收到的URL是否符合安全规则,并且只对符合安全规则的URL进行解析,从而避免被攻击。
基于现有技术,需要一种更为安全可靠的检测URL的方法。
发明内容
本说明书实施例提供一种模型训练方法、检测URL的方法及装置,以解决现有的检测URL的方法安全性不高的问题。
为解决上述技术问题,本说明书实施例是这样实现的:
本说明书实施例提供的一种模型训练方法,包括:
获取若干统一资源定位符URL;
针对每个URL,提取该URL中的参数;
针对提取的每个参数,确定该参数对应的特征向量;
根据各参数分别对应的特征向量,构建隔绝森林Isolation Forest模型,所述隔绝森林模型用于检测URL是否异常。
本说明书实施例提供的一种检测URL的方法,包括:
获取URL;
提取所述URL中的参数;
针对提取的每个参数,确定该参数对应的特征向量;
将各参数分别对应的特征向量输入到预先构建的隔绝森林模型,以对所述URL进行异常检测;所述隔绝森林模型是根据上述模型训练方法构建的。
本说明书实施例提供的一种模型训练装置,包括:
获取模块,获取若干统一资源定位符URL;
提取模块,针对每个URL,提取该URL中的参数;
确定模块,针对提取的每个参数,确定该参数对应的特征向量;
处理模块,根据各参数分别对应的特征向量,构建隔绝森林模型,所述隔绝森林模型用于检测URL是否异常。
本说明书实施例提供的一种检测URL的装置,包括:
获取模块,获取URL;
提取模块,提取所述URL中的参数;
确定模块,针对提取的每个参数,确定该参数对应的特征向量;
异常检测模块,将各参数分别对应的特征向量输入到预先构建的隔绝森林Isolation Forest模型,以对所述URL进行异常检测;所述隔绝森林模型是根据上述模型训练方法构建的。
本说明书实施例提供的一种模型训练设备,包括一个或多个处理器及存储器,所述存储器存储有程序,并且被配置成由所述一个或多个处理器执行以下步骤:
获取若干统一资源定位符URL;
针对每个URL,提取该URL中的参数;
针对提取的每个参数,确定该参数对应的特征向量;
根据各参数分别对应的特征向量,构建隔绝森林模型,所述隔绝森林模型用于检测URL是否异常。
本说明书实施例提供的一种检测URL的设备,包括一个或多个处理器及存储器,所 述存储器存储有程序,并且被配置成由所述一个或多个处理器执行以下步骤:
获取URL;
提取所述URL中的参数;
针对提取的每个参数,确定该参数对应的特征向量;
将各参数分别对应的特征向量输入到预先构建的隔绝森林模型,以对所述URL进行异常检测;所述隔绝森林模型是根据上述模型训练方法构建的。
由以上本说明书实施例提供的技术方案可见,在本说明书实施例中,获取若干URL,确定每个URL中的参数,并得到每个参数对应的特征向量,然后根据各参数分别对应的特征向量,构建隔绝森林模型。隔绝森林模型可以用于检测URL是否异常。一般而言,异常的URL往往就是黑客发送的URL,服务器可以拒绝解析异常的URL,从避免被黑客攻击。
附图说明
为了更清楚地说明本说明书实施例或现有技术中的技术方案,下面将对实施例或现有技术描述中所需要使用的附图作简单地介绍,显而易见地,下面描述中的附图仅仅是本说明书中记载的一些实施例,对于本领域普通技术人员来讲,在不付出创造性劳动性的前提下,还可以根据这些附图获得其他的附图。
图1是本说明书实施例提供的一种模型训练方法流程图;
图2a~c是本说明书实施例提供的正常点与异常点分布示意图;
图3是本说明书实施例提供的一种检测URL的方法流程图;
图4是本说明书实施例提供的一种模型训练装置示意图;
图5是本说明书实施例提供的一种检测URL的装置示意图;
图6是本说明书实施例提供的一种模型训练设备示意图;
图7是本说明书实施例提供的一种检测URL的设备示意图。
具体实施方式
现有的检测URL的方法是由服务器根据人工制定的安全规则对URL进行检测。但 是,一方面,黑客利用URL进行网络攻击的手段千变万化,人工制定的安全规则难以涵盖各攻击手段;另一方面,人工制定的安全规则通常滞后于新出现的攻击手段。
为此,在本说明书的一个或多个实施例中,获取若干URL,提取各URL中的参数,并确定每个参数对应的特征向量,根据各参数分别对应的特征向量,构建隔绝森林Isolation Forest模型。为本领域技术人员所熟知的是,隔绝森林模型是一种异常检测模型,使用隔绝森林模型可以检测出某个URL是否异常,而异常的URL往往就是被黑客发送的URL,服务器可以拒绝解析异常的URL,从而避免被黑客攻击。
需要说明的是,之所以可以根据若干URL中的参数对应的特征向量构建隔绝森林模型,是因为在实践中,黑客利用URL对服务器进行攻击的主要手段就是在URL的参数中添加非法字段。也就是说,正常的URL中参数的特征向量和异常的URL中参数的特征向量存在显著区别。异常的URL中参数的特征往往是罕见的,明显区别于正常的URL中参数的特征。
基于此,本说明书所述的技术方案的核心思想在于,将已知的若干URL中参数的特征向量作为数据样本,构建隔绝森林模型。隔绝森林模型可以根据某个待检测的URL中的参数的特征向量判断出该URL是否异常。
为了使本技术领域的人员更好地理解本说明书中的技术方案,下面将结合本说明书一个或多个实施例中的附图,对本说明书实施例中的技术方案进行清楚、完整地描述,显然,所描述的实施例仅仅是本说明书一部分实施例,而不是全部的实施例。通过本说明书实施例,本领域普通技术人员在没有作出创造性劳动前提下所获得的所有其他实施例,都应当属于本说明书保护的范围。
以下结合附图,详细说明本说明书各实施例提供的技术方案。
图1是本说明书实施例提供的模型训练方法流程图,包括以下步骤:
S100:获取若干URL。
在本说明书实施例中,执行主体可以是服务器或其他具有数据处理能力的设备,下文将以执行主体是服务器为例。
众所周知,对于一个URL而言,该URL中的参数可以包含用户(可能是黑客)输入的一些信息。
举例来说,“http://server/path/document?name1=value1&name2=value2”是一个URL 的典型结构,“?”后的数据即是参数。一个URL中可以包含不止一个参数,不同的参数之间通常以“&”分隔,每个参数具有参数名和参数值。参数值通常是由用户输入的。在本例中,该URL包含两个参数,“name1=value1”表示参数名为name1的参数的参数值为value1;“name2=value2”表示参数名为name2的参数的参数值为value2。
黑客有时候会在URL的参数中添加异常的非法字段,以对服务器进行攻击。举例来说,倘若善意用户登录服务器时发送的正常的URL如下:
“http://server/path/document?name1=user1&name2=password1”,其中,第一参数的参数值为用户名“user1”,第二个参数的参数值为密码“password1”,服务器解析该URL,验证用户名和密码通过后,用户登录到服务器。
而黑客想要冒充用户“user1”登录服务器时,可采用SQL注入攻击的手段,向服务器发送如下异常的URL:
“http://server/path/document?name1=user1&name2=″′or 1=1”,其中,第一参数的参数值为用户名“user1”,第二个参数的参数值却不是对应于用户名的密码,而是非法字段“″′or 1=1”,由于SQL语法固有的特性,当服务器根据该非法字段无法对用户的密码进行验证时,该非法字段会被服务器解析为可执行代码而被服务器执行,导致黑客无需密码也可以登录到用户“user1”的账号,对用户的数据进行操作。
在本步骤S200中,服务器获取的若干URL中一般包含部分正常的URL以及部分异常的URL。而由于异常的URL较为罕见,其在所述若干URL中所占的比例较低。
S102:针对每个URL,提取该URL中的参数。
在本说明书实施例中,服务器提取URL中的参数可以是提取URL中包含的参数名和参数值,也可以是仅提取URL中的参数的参数值。
此外,服务器针对每个URL,可以提取该URL中的全部参数,也可以提取该URL中的部分参数。
由于在实际应用中,有些参数名的出现概率较低,黑客也很少将非法字段添加到这些出现概率较低的参数名对应的参数值中,因此,服务器可以不提取出现概率较低的参数名对应的参数值。
具体而言,服务器可以针对每个URL,在该URL中包含的参数中,确定参数名满足指定条件的参数;针对确定的每个参数,提取该参数的参数值。其中,所述指定条件 可以是参数名的出现概率大于指定概率值。如此一来,可以将出现概率较低的参数过滤掉,减轻了服务器在后续步骤中处理数据的负担。
S104:针对提取的每个参数,确定该参数对应的特征向量。
在本说明书实施例中,可以针对提取的每个参数,根据该参数的参数值,确定该参数对应的N维特征向量;N为大于0的自然数。
其中,参数对应特征向量的维度可以包括参数的参数值包含的字符总数、字母总数、数字总数、特定符号总数、不同字符的数量、不同字母的数量、不同数字的数量、不同的特定符号的数量中的至少一个。
以URL“http://server/path/document?name1=user1&name2=password1”为例,该URL中的参数name1的参数值为user1,该参数值包含的字符总数5,字母总数4,数字总数1,特定符号总数0,不同字符的数量5,不同字母的数量4,不同数字的数量1,不同的特定符号的数量0。那么,参数name1对应的特征向量可以是(5,4,1,0,5,4,1,0)。
进一步地,可以对特征向量的每个维度的取值进行归一化处理。此处还是沿用上例说明,可以根据公式
Figure PCTCN2018105176-appb-000001
对参数name1对应的8个特征向量值进行归一化处理。其中,x表示特征向量值,z表示参数name1包含的字符总数,y表示对x进行归一化处理后构建的数值。那么,参数name1包含的特征向量向量为(5/5,4/5,1/5,0/5,5/5,4/5,1/5,0/5),即(1,0.8,0.2,0,1,0.8,0.8,0)。
S106:根据各参数分别对应的特征向量,构建隔绝森林模型。
在本说明书实施例中,采用隔绝森林算法,根据各参数分别对应的特征向量构建隔绝森林模型,所述隔绝森林模型用于检测URL是否异常。其中,无需对各参数对应的特征向量进行正常或异常的标注。
此处对隔绝森林算法的思想进行简要介绍。参见图2a,在图2a所示的这10个点中包括空心点和实心点,空心点的数量较多(8个),且分布较为集中,而实心点的数量较少(2个),且分布较为分散。可以将空心点视为正常点,实心点视为异常点。也就是说,异常点就是少数且离群的点。然后进行如下操作:
第1次划分:随机出现一条线,将图2a中的这些点划分为A部分和B部分,得到图2b。
第2次划分:针对A部分,继续随机出现一条线,将A部分中的点划分为C部分和D部分;同样,针对B部分,也随机出现一条线,将B部分中的点划分为E部分和F部分,如图2c。
继续针对每个新划分的部分随机出现一条线,继续划分,直至将图2a所示的平面划分为10个部分,每个部分仅包含1个点,即每个点都被划分到一个专属部分(若某个部分中只包括一个点,则这个部分就是这个点的专属部分)中。显然,实心点更容易也更快会被划入专属部分,如图2b中所示的,右上角的实心点已经被划入专属部分(F部分)。也就是说,某个点越容易被划入专属部分,这个点就越异常。
正是基于以上思想,在隔绝森林算法中,存在S个分类树(具体可以是二叉树),针对每个二叉树而言,将图2a所示的这些点放入根节点,从根节点开始,每一次分叉的条件是随机的(即每一次用一条随机出现的线对点进行划分),在该二叉树中,越早落入叶子节点的点其异常的可能性越高。
以上述隔绝森林算法为例,对步骤S106中根据各参数分别对应的特征向量,构建隔绝森林模型进行简述。
隔绝森林包括S个二叉树(iTree),针对每个iTree,训练该iTree的过程可以描述如下:
第一步,在各特征向量中,随机选择M个特征向量,放入该iTree的根节点;
第二步,在特征向量的N个维度中,随机指定一个维度(指定维度),并在该指定维度的取值中,随机指定一个取值,作为切割值;所述切割值介于M个特征向量的该指定维度的取值中的最大值和最小值之间;
第三步,根据所述切割值,将M个特征向量划分为两部分,指定维度的取值不小于所述切割值的特征向量为一部分,指定维度的取值小于所述切割值的为另一部分;
第四步,递归执行第二步和第三步,直至该iTree达到指定高度或该iTree的叶子节点上都只被放入了一个特征向量。其中,指定高度可以根据需要设置,一般为log2M。
通过以上四步,就可以训练出一个iTree。
需要说明的是,当训练下一个iTree时,在第一步中,可以在全部的特征向量中随机选择M个特征向量,也可以在未被选择过的特征向量中随机选择M个特征向量。
重复执行上述四步,可以得到S个训练好的iTree,组成隔绝森林模型。
图3本说明书实施例提供的一种检测URL的方法流程图,包括以下步骤:
S300:获取URL。
S302:提取所述URL中的参数。
S304:针对提取的每个参数,确定该参数对应的特征向量。
S306:将各参数分别对应的特征向量输入到预先构建的隔绝森林模型,以对所述URL进行异常检测。
图3中的所述URL是待检测的URL。对步骤S300~S304的说明可以参见步骤S100~S104,不再赘述。
在步骤S306中,可以将各参数分别对应的特征向量输入到隔绝森林模型,得到各参数分别对应的模型输出结果,根据各参数分别对应的模型输出结果,判断各参数中是否存在异常的参数。
进一步地,可以针对每个参数,将该参数对应的特征向量输入到隔绝森林模型,以通过所述隔绝森林模型中的各分类树对该参数对应的特征向量进行分类,确定该参数对应的特征向量在各分类树中所落入的叶子节点的平均高度,作为该参数对应的模型输出结果;然后,针对每个参数,若该参数对应的模型输出结果小于指定阈值,则确定该参数异常,若该参数对应的模型输出结果不小于指定阈值,则确定该参数正常;当确定任一参数异常时,则确定各参数中存在异常的参数;当确定各参数都正常时,则确定各参数中不存在异常的参数。
通过图1和图3所示的方法,根据URL中的参数的特征向量,构建隔绝森林模型,使得服务器可以通过隔绝森林模型对接收到的URL进行检测,如果确定接收到的URL异常,则可以拒绝解析该URL,从而避免被黑客攻击,提升了网络安全性。
此外,通过本说明书实施例,还可以发现潜在的网络攻击手段。具体而言,通过隔绝森林模型可以确定某个URL是否异常,如果该URL异常,那么就意味着该参数的参数值是异常的,异常的参数值可以提示工作人员分析出黑客采用的攻击手段,方便工作人员完善安全规则。
基于图1所示的模型训练方法,本说明书实施例还对应提供了一种模型训练装置,如图4所示,包括:
获取模块401,获取若干统一资源定位符URL;
提取模块402,针对每个URL,提取该URL中的参数;
确定模块403,针对提取的每个参数,确定该参数对应的特征向量;
处理模块404,根据各参数分别对应的特征向量,构建隔绝森林模型,所述隔绝森林模型用于检测URL是否异常。
所述提取模块,针对每个URL,在该URL包含的参数中,确定参数名满足指定条件的参数;针对确定的每个参数,提取该参数的参数值。
所述确定模块,针对提取的每个参数,根据该参数的参数值,确定该参数对应的N维特征向量;N为大于0的自然数。
N维特征向量的维度,具体包括:参数的参数值包含的字符总数、字母总数、数字总数、符号总数、不同字符的数量、不同字母的数量、不同数字的数量和不同符号的数量中的至少一个。
基于图3所示的检测URL的方法,本说明书实施例还对应提供了一种检测URL的装置,如图5所示,包括:
获取模块501,获取URL;
提取模块502,提取所述URL中的参数;
确定模块503,针对提取的每个参数,确定该参数对应的特征向量;
异常检测模块,将各参数分别对应的特征向量输入到预先构建的隔绝森林Isolation Forest模型,以对所述URL进行异常检测;所述隔绝森林模型是根据上述模型训练方法构建的。
所述异常检测模块,将各参数分别对应的特征向量输入到预先构建的隔绝森林Isolation Forest模型,构建各参数分别对应的模型输出结果;根据各参数分别对应的模型输出结果,判断各参数中是否存在异常的参数;若是,则确定所述URL异常;否则,确定所述URL正常。
所述异常检测模块,针对每个参数,将该参数对应的特征向量输入到预先构建的隔绝森林模型,以通过所述隔绝森林模型中的各分类树对该参数对应的特征向量进行分类,确定该参数对应的特征向量在各分类树中所落入的叶子节点的平均高度,作为该参数对应的模型输出结果;针对每个参数,若该参数对应的模型输出结果小于指定阈值,则确定该参数异常,若该参数对应的模型输出结果不小于指定阈值,则确定该参数正常。
基于图2所示的模型训练方法,本说明书实施例还对应提供了一种模型训练设备,如图6所示,包括一个或多个处理器及存储器,所述存储器存储有程序,并且被配置成由所述一个或多个处理器执行以下步骤:
获取若干统一资源定位符URL;
针对每个URL,提取该URL中的参数;
针对提取的每个参数,确定该参数对应的特征向量;
根据各参数分别对应的特征向量,构建隔绝森林Isolation Forest模型,所述隔绝森林模型用于检测URL是否异常。
基于图3所示的检测URL的方法,本说明书实施例还对应提供了一种检测URL的设备,如图7所示,包括一个或多个处理器及存储器,所述存储器存储有程序,并且被配置成由所述一个或多个处理器执行以下步骤:
获取URL;
提取所述URL中的参数;
针对提取的每个参数,确定该参数对应的特征向量;
将各参数分别对应的特征向量输入到预先构建的隔绝森林Isolation Forest模型,以对所述URL进行异常检测;所述隔绝森林模型是根据上述模型训练方法构建的。
本说明书中的各个实施例均采用递进的方式描述,各个实施例之间相同相似的部分互相参见即可,每个实施例重点说明的都是与其他实施例的不同之处。尤其,对于图6和图7所示的设备而言,由于其基本相似于方法实施例,所以描述的比较简单,相关之处参见方法实施例的部分说明即可。
在20世纪90年代,对于一个技术的改进可以很明显地区分是硬件上的改进(例如,对二极管、晶体管、开关等电路结构的改进)还是软件上的改进(对于方法流程的改进)。然而,随着技术的发展,当今的很多方法流程的改进已经可以视为硬件电路结构的直接改进。设计人员几乎都通过将改进的方法流程编程到硬件电路中来得到相应的硬件电路结构。因此,不能说一个方法流程的改进就不能用硬件实体模块来实现。例如,可编程逻辑器件(Programmable Logic Device,PLD)(例如现场可编程门阵列(Field Programmable Gate Array,FPGA))就是这样一种集成电路,其逻辑功能由用户对器件编程来确定。由设计人员自行编程来把一个数字符系统“集成”在一片PLD上,而不需要 请芯片制造厂商来设计和制作专用的集成电路芯片。而且,如今,取代手工地制作集成电路芯片,这种编程也多半改用“逻辑编译器(logic compiler)”软件来实现,它与程序开发撰写时所用的软件编译器相类似,而要编译之前的原始代码也得用特定的编程语言来撰写,此称之为硬件描述语言(Hardware Description Language,HDL),而HDL也并非仅有一种,而是有许多种,如ABEL(Advanced Boolean Expression Language)、AHDL(Altera Hardware Description Language)、Confluence、CUPL(Cornell University Programming Language)、HDCal、JHDL(Java Hardware Description Language)、Lava、Lola、MyHDL、PALASM、RHDL(Ruby Hardware Description Language)等,目前最普遍使用的是VHDL(Very-High-Speed Integrated Circuit Hardware Description Language)与Verilog。本领域技术人员也应该清楚,只需要将方法流程用上述几种硬件描述语言稍作逻辑编程并编程到集成电路中,就可以很容易得到实现该逻辑方法流程的硬件电路。
控制器可以按任何适当的方式实现,例如,控制器可以采取例如微处理器或处理器以及存储可由该(微)处理器执行的计算机可读程序代码(例如软件或固件)的计算机可读介质、逻辑门、开关、专用集成电路(Application Specific Integrated Circuit,ASIC)、可编程逻辑控制器和嵌入微控制器的形式,控制器的例子包括但不限于以下微控制器:ARC 625D、Atmel AT91SAM、Microchip PIC18F26K20以及Silicone Labs C8051F320,存储器控制器还可以被实现为存储器的控制逻辑的一部分。本领域技术人员也知道,除了以纯计算机可读程序代码方式实现控制器以外,完全可以通过将方法步骤进行逻辑编程来使得控制器以逻辑门、开关、专用集成电路、可编程逻辑控制器和嵌入微控制器等的形式来实现相同功能。因此这种控制器可以被认为是一种硬件部件,而对其内包括的用于实现各种功能的装置也可以视为硬件部件内的结构。或者甚至,可以将用于实现各种功能的装置视为既可以是实现方法的软件模块又可以是硬件部件内的结构。
上述实施例阐明的系统、装置、模块或单元,具体可以由计算机芯片或实体实现,或者由具有某种功能的产品来实现。一种典型的实现设备为计算机。具体的,计算机例如可以为个人计算机、膝上型计算机、蜂窝电话、相机电话、智能电话、个人数字符助理、媒体播放器、导航设备、电子邮件设备、游戏控制台、平板计算机、可穿戴设备或者这些设备中的任何设备的组合。
为了描述的方便,描述以上装置时以功能分为各种单元分别描述。当然,在实 施本说明书时可以把各单元的功能在同一个或多个软件和/或硬件中实现。
本领域内的技术人员应明白,本发明的实施例可提供为方法、系统、或计算机程序产品。因此,本发明可采用完全硬件实施例、完全软件实施例、或结合软件和硬件方面的实施例的形式。而且,本发明可采用在一个或多个其中包含有计算机可用程序代码的计算机可用存储介质(包括但不限于磁盘存储器、CD-ROM、光学存储器等)上实施的计算机程序产品的形式。
本发明是参照根据本发明实施例的方法、设备(系统)、和计算机程序产品的流程图和/或方框图来描述的。应理解可由计算机程序指令实现流程图和/或方框图中的每一流程和/或方框、以及流程图和/或方框图中的流程和/或方框的结合。可提供这些计算机程序指令到通用计算机、专用计算机、嵌入式处理机或其他可编程数据处理设备的处理器以产生一个机器,使得通过计算机或其他可编程数据处理设备的处理器执行的指令产生用于实现在流程图一个流程或多个流程和/或方框图一个方框或多个方框中指定的功能的装置。
这些计算机程序指令也可存储在能引导计算机或其他可编程数据处理设备以特定方式工作的计算机可读存储器中,使得存储在该计算机可读存储器中的指令产生包括指令装置的制造品,该指令装置实现在流程图一个流程或多个流程和/或方框图一个方框或多个方框中指定的功能。
这些计算机程序指令也可装载到计算机或其他可编程数据处理设备上,使得在计算机或其他可编程设备上执行一系列操作步骤以产生计算机实现的处理,从而在计算机或其他可编程设备上执行的指令提供用于实现在流程图一个流程或多个流程和/或方框图一个方框或多个方框中指定的功能的步骤。
在一个典型的配置中,计算设备包括一个或多个处理器(CPU)、输入/输出接口、网络接口和内存。
内存可能包括计算机可读介质中的非永久性存储器,随机存取存储器(RAM)和/或非易失性内存等形式,如只读存储器(ROM)或闪存(flash RAM)。内存是计算机可读介质的示例。
计算机可读介质包括永久性和非永久性、可移动和非可移动媒体可以由任何方法或技术来实现信息存储。信息可以是计算机可读指令、数据结构、程序的模块或其他数据。计算机的存储介质的例子包括,但不限于相变内存(PRAM)、静态随机存取存储 器(SRAM)、动态随机存取存储器(DRAM)、其他类型的随机存取存储器(RAM)、只读存储器(ROM)、电可擦除可编程只读存储器(EEPROM)、快闪记忆体或其他内存技术、只读光盘只读存储器(CD-ROM)、数字符多功能光盘(DVD)或其他光学存储、磁盒式磁带,磁带磁磁盘存储或其他磁性存储设备或任何其他非传输介质,可用于存储可以被计算设备访问的信息。按照本文中的界定,计算机可读介质不包括暂存电脑可读媒体(transitory media),如调制的数据信号和载波。
还需要说明的是,术语“包括”、“包含”或者其任何其他变体意在涵盖非排他性的包含,从而使得包括一系列要素的过程、方法、商品或者设备不仅包括那些要素,而且还包括没有明确列出的其他要素,或者是还包括为这种过程、方法、商品或者设备所固有的要素。在没有更多限制的情况下,由语句“包括一个……”限定的要素,并不排除在包括所述要素的过程、方法、商品或者设备中还存在另外的相同要素。
本领域技术人员应明白,本说明书的实施例可提供为方法、系统或计算机程序产品。因此,本说明书可采用完全硬件实施例、完全软件实施例或结合软件和硬件方面的实施例的形式。而且,本说明书可采用在一个或多个其中包含有计算机可用程序代码的计算机可用存储介质(包括但不限于磁盘存储器、CD-ROM、光学存储器等)上实施的计算机程序产品的形式。
本说明书可以在由计算机执行的计算机可执行指令的一般上下文中描述,例如程序模块。一般地,程序模块包括执行特定任务或实现特定抽象数据类型的例程、程序、对象、组件、数据结构等等。也可以在分布式计算环境中实践本说明书,在这些分布式计算环境中,由通过通信网络而被连接的远程处理设备来执行任务。在分布式计算环境中,程序模块可以位于包括存储设备在内的本地和远程计算机存储介质中。
以上所述仅为本说明书的实施例而已,并不用于限制本说明书。对于本领域技术人员来说,本说明书可以有各种更改和变化。凡在本说明书的精神和原理之内所作的任何修改、等同替换、改进等,均应包含在本说明书的权利要求范围之内。

Claims (16)

  1. 一种模型训练方法,包括:
    获取若干统一资源定位符URL;
    针对每个URL,提取该URL中的参数;
    针对提取的每个参数,确定该参数对应的特征向量;
    根据各参数分别对应的特征向量,构建隔绝森林Isolation Forest模型,所述隔绝森林模型用于检测URL是否异常。
  2. 根据权利要求1所述的方法,针对每个URL,提取该URL中的参数,具体包括:
    针对每个URL,在该URL包含的参数中,确定参数名满足指定条件的参数;
    针对确定的每个参数,提取该参数的参数值。
  3. 根据权利要求2所述的方法,针对提取的每个参数,确定该参数对应的特征向量,具体包括:
    针对提取的每个参数,根据该参数的参数值,确定该参数对应的N维特征向量;N为大于0的自然数。
  4. 根据权利要求3所述的方法,N维特征向量的维度,具体包括:
    参数的参数值包含的字符总数、字母总数、数字总数、符号总数、不同字符的数量、不同字母的数量、不同数字的数量和不同符号的数量中的至少一个。
  5. 一种检测URL的方法,包括:
    获取URL;
    提取所述URL中的参数;
    针对提取的每个参数,确定该参数对应的特征向量;
    将各参数分别对应的特征向量输入到预先构建的隔绝森林模型,以对所述URL进行异常检测;所述隔绝森林模型是根据权利要求1~4任一项所述的方法构建的。
  6. 根据权利要求5所述的方法,将各参数分别对应的特征向量输入到预先构建的隔绝森林模型,以对所述URL进行异常检测,具体包括:
    将各参数分别对应的特征向量输入到预先构建的隔绝森林模型,得到各参数分别对应的模型输出结果;
    根据各参数分别对应的模型输出结果,判断各参数中是否存在异常的参数;
    若是,则确定所述URL异常;
    否则,确定所述URL正常。
  7. 根据权利要求6所述的方法,将各参数分别对应的特征向量输入到预先构建的 隔绝森林模型,得到各参数分别对应的模型输出结果,具体包括:
    针对每个参数,将该参数对应的特征向量输入到预先构建的隔绝森林模型,以通过所述隔绝森林模型中的各分类树对该参数对应的特征向量进行分类,确定该参数对应的特征向量在各分类树中所落入的叶子节点的平均高度,作为该参数对应的模型输出结果;
    根据各参数分别对应的模型输出结果,判断各参数中是否存在异常的参数,具体包括:
    针对每个参数,若该参数对应的模型输出结果小于指定阈值,则确定该参数异常,若该参数对应的模型输出结果不小于指定阈值,则确定该参数正常。
  8. 一种模型训练装置,包括:
    获取模块,获取若干统一资源定位符URL;
    提取模块,针对每个URL,提取该URL中的参数;
    确定模块,针对提取的每个参数,确定该参数对应的特征向量;
    处理模块,根据各参数分别对应的特征向量,构建隔绝森林模型,所述隔绝森林模型用于检测URL是否异常。
  9. 根据权利要求8所述的装置,所述提取模块,针对每个URL,在该URL包含的参数中,确定参数名满足指定条件的参数;针对确定的每个参数,提取该参数的参数值。
  10. 根据权利要求9所述的装置,所述确定模块,针对提取的每个参数,根据该参数的参数值,确定该参数对应的N维特征向量;N为大于0的自然数。
  11. 根据权利要求10所述的装置,N维特征向量的维度,具体包括:
    参数的参数值包含的字符总数、字母总数、数字总数、符号总数、不同字符的数量、不同字母的数量、不同数字的数量和不同符号的数量中的至少一个。
  12. 一种检测URL的装置,包括:
    获取模块,获取URL;
    提取模块,提取所述URL中的参数;
    确定模块,针对提取的每个参数,确定该参数对应的特征向量;
    异常检测模块,将各参数分别对应的特征向量输入到预先构建的隔绝森林模型,以对所述URL进行异常检测;所述隔绝森林模型是根据权利要求1~4任一项所述的方法构建的。
  13. 根据权利要求12所述的装置,所述异常检测模块,将各参数分别对应的特征向量输入到预先构建的隔绝森林模型,得到各参数分别对应的模型输出结果;根据各参 数分别对应的模型输出结果,判断各参数中是否存在异常的参数;若是,则确定所述URL异常;否则,确定所述URL正常。
  14. 根据权利要求13所述的装置,所述异常检测模块,针对每个参数,将该参数对应的特征向量输入到预先构建的隔绝森林模型,以通过所述隔绝森林模型中的各分类树对该参数对应的特征向量进行分类,确定该参数对应的特征向量在各分类树中所落入的叶子节点的平均高度,作为该参数对应的模型输出结果;针对每个参数,若该参数对应的模型输出结果小于指定阈值,则确定该参数异常,若该参数对应的模型输出结果不小于指定阈值,则确定该参数正常。
  15. 一种模型训练设备,包括一个或多个处理器及存储器,所述存储器存储有程序,并且被配置成由所述一个或多个处理器执行以下步骤:
    获取若干统一资源定位符URL;
    针对每个URL,提取该URL中的参数;
    针对提取的每个参数,确定该参数对应的特征向量;
    根据各参数分别对应的特征向量,构建隔绝森林模型,所述隔绝森林模型用于检测URL是否异常。
  16. 一种检测URL的设备,包括一个或多个处理器及存储器,所述存储器存储有程序,并且被配置成由所述一个或多个处理器执行以下步骤:
    获取URL;
    提取所述URL中的参数;
    针对提取的每个参数,确定该参数对应的特征向量;
    将各参数分别对应的特征向量输入到预先构建的隔绝森林模型,以对所述URL进行异常检测;所述隔绝森林模型是根据权利要求1~4任一项所述的方法构建的。
PCT/CN2018/105176 2017-10-24 2018-09-12 一种模型训练方法、检测url的方法及装置 WO2019080660A1 (zh)

Applications Claiming Priority (2)

Application Number Priority Date Filing Date Title
CN201710998117.7A CN107992741B (zh) 2017-10-24 2017-10-24 一种模型训练方法、检测url的方法及装置
CN201710998117.7 2017-10-24

Publications (1)

Publication Number Publication Date
WO2019080660A1 true WO2019080660A1 (zh) 2019-05-02

Family

ID=62030610

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/CN2018/105176 WO2019080660A1 (zh) 2017-10-24 2018-09-12 一种模型训练方法、检测url的方法及装置

Country Status (3)

Country Link
CN (2) CN112182578A (zh)
TW (1) TWI696090B (zh)
WO (1) WO2019080660A1 (zh)

Cited By (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN110399268A (zh) * 2019-07-26 2019-11-01 阿里巴巴集团控股有限公司 一种异常数据检测的方法、装置及设备
CN114095391A (zh) * 2021-11-12 2022-02-25 上海斗象信息科技有限公司 一种数据检测方法、基线模型构建方法及电子设备
CN116776135A (zh) * 2023-08-24 2023-09-19 之江实验室 一种基于神经网络模型的物理场数据预测方法及装置

Families Citing this family (10)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN112182578A (zh) * 2017-10-24 2021-01-05 创新先进技术有限公司 一种模型训练方法、检测url的方法及装置
CN108229156A (zh) 2017-12-28 2018-06-29 阿里巴巴集团控股有限公司 Url攻击检测方法、装置以及电子设备
CN110086749A (zh) * 2018-01-25 2019-08-02 阿里巴巴集团控股有限公司 数据处理方法及装置
CN108366071B (zh) 2018-03-06 2020-06-23 阿里巴巴集团控股有限公司 Url异常定位方法、装置、服务器及存储介质
CN108984376B (zh) * 2018-05-31 2021-11-19 创新先进技术有限公司 一种系统异常检测方法、装置及设备
CN108777873B (zh) * 2018-06-04 2021-03-02 江南大学 基于加权混合孤立森林的无线传感网络异常数据检测方法
CN110032881B (zh) * 2018-12-28 2023-09-22 创新先进技术有限公司 一种数据处理方法、装置、设备及介质
CN109815566A (zh) * 2019-01-09 2019-05-28 同济大学 一种sgf格式的围棋ai棋谱文件的异常检测方法
CN110958222A (zh) * 2019-10-31 2020-04-03 苏州浪潮智能科技有限公司 基于孤立森林算法的服务器日志异常检测方法及系统
CN113065610B (zh) * 2019-12-12 2022-05-17 支付宝(杭州)信息技术有限公司 基于联邦学习的孤立森林模型构建和预测方法和装置

Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN103544210A (zh) * 2013-09-02 2014-01-29 烟台中科网络技术研究所 一种识别网页类型的系统和方法
CN104077396A (zh) * 2014-07-01 2014-10-01 清华大学深圳研究生院 一种钓鱼网站检测方法及装置
US20150078654A1 (en) * 2013-09-13 2015-03-19 Interra Systems, Inc. Visual Descriptors Based Video Quality Assessment Using Outlier Model
CN104899508A (zh) * 2015-06-17 2015-09-09 中国互联网络信息中心 一种多阶段钓鱼网站检测方法与系统
CN107992741A (zh) * 2017-10-24 2018-05-04 阿里巴巴集团控股有限公司 一种模型训练方法、检测url的方法及装置

Family Cites Families (9)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US7082426B2 (en) * 1993-06-18 2006-07-25 Cnet Networks, Inc. Content aggregation method and apparatus for an on-line product catalog
JP6276417B2 (ja) * 2013-11-04 2018-02-07 イルミオ, インコーポレイテッドIllumio,Inc. ラベルベースのアクセス制御ルールの自動生成
CN105554007B (zh) * 2015-12-25 2019-01-04 北京奇虎科技有限公司 一种web异常检测方法和装置
KR20170108330A (ko) * 2016-03-17 2017-09-27 한국전자통신연구원 악성 코드 탐지 장치 및 방법
CN105956472B (zh) * 2016-05-12 2019-10-18 宝利九章(北京)数据技术有限公司 识别网页中是否包含恶意内容的方法和系统
CN106131071B (zh) * 2016-08-26 2019-06-04 北京奇虎科技有限公司 一种Web异常检测方法和装置
CN106846806A (zh) * 2017-03-07 2017-06-13 北京工业大学 基于Isolation Forest的城市道路交通异常检测方法
CN106960040B (zh) * 2017-03-27 2019-09-17 北京神州绿盟信息安全科技股份有限公司 一种url的类别确定方法及装置
CN107196953B (zh) * 2017-06-14 2020-05-08 上海境领信息科技有限公司 一种基于用户行为分析的异常行为检测方法

Patent Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN103544210A (zh) * 2013-09-02 2014-01-29 烟台中科网络技术研究所 一种识别网页类型的系统和方法
US20150078654A1 (en) * 2013-09-13 2015-03-19 Interra Systems, Inc. Visual Descriptors Based Video Quality Assessment Using Outlier Model
CN104077396A (zh) * 2014-07-01 2014-10-01 清华大学深圳研究生院 一种钓鱼网站检测方法及装置
CN104899508A (zh) * 2015-06-17 2015-09-09 中国互联网络信息中心 一种多阶段钓鱼网站检测方法与系统
CN107992741A (zh) * 2017-10-24 2018-05-04 阿里巴巴集团控股有限公司 一种模型训练方法、检测url的方法及装置

Cited By (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN110399268A (zh) * 2019-07-26 2019-11-01 阿里巴巴集团控股有限公司 一种异常数据检测的方法、装置及设备
CN110399268B (zh) * 2019-07-26 2023-09-26 创新先进技术有限公司 一种异常数据检测的方法、装置及设备
CN114095391A (zh) * 2021-11-12 2022-02-25 上海斗象信息科技有限公司 一种数据检测方法、基线模型构建方法及电子设备
CN114095391B (zh) * 2021-11-12 2024-01-12 上海斗象信息科技有限公司 一种数据检测方法、基线模型构建方法及电子设备
CN116776135A (zh) * 2023-08-24 2023-09-19 之江实验室 一种基于神经网络模型的物理场数据预测方法及装置
CN116776135B (zh) * 2023-08-24 2023-12-19 之江实验室 一种基于神经网络模型的物理场数据预测方法及装置

Also Published As

Publication number Publication date
CN112182578A (zh) 2021-01-05
CN107992741B (zh) 2020-08-28
TW201917618A (zh) 2019-05-01
TWI696090B (zh) 2020-06-11
CN107992741A (zh) 2018-05-04

Similar Documents

Publication Publication Date Title
TWI696090B (zh) 模型訓練方法、檢測url的方法及裝置
KR102272117B1 (ko) 블록체인 기반 데이터 프로세싱 방법 및 디바이스
JP6804668B2 (ja) ブロックデータ検証方法および装置
TWI715999B (zh) 身份資訊的識別方法及裝置
CN109246064B (zh) 安全访问控制、网络访问规则的生成方法、装置及设备
US20160342793A1 (en) Automatic Library Detection
WO2019128529A1 (zh) Url攻击检测方法、装置以及电子设备
KR101874373B1 (ko) 난독화 스크립트에 대한 악성 스크립트 탐지 방법 및 그 장치
CN111835777B (zh) 一种异常流量检测方法、装置、设备及介质
CN111159697B (zh) 一种密钥检测方法、装置及电子设备
CN109714356A (zh) 一种异常域名的识别方法、装置及电子设备
Brown et al. Detection of mobile malware: an artificial immunity approach
US9519780B1 (en) Systems and methods for identifying malware
US10181035B1 (en) System and method for .Net PE file malware detection
US9646157B1 (en) Systems and methods for identifying repackaged files
US10013539B1 (en) Rapid device identification among multiple users
CN108334775B (zh) 一种越狱插件检测方法及装置
CN111541687A (zh) 一种网络攻击检测方法及装置
CN113688240B (zh) 威胁要素提取方法、装置、设备及存储介质
US9235639B2 (en) Filter regular expression
CN110413871B (zh) 应用推荐方法、装置及电子设备
JP7140268B2 (ja) 警告装置、制御方法、及びプログラム
CN112491816A (zh) 业务数据处理方法及装置
CN105279434A (zh) 恶意程序样本家族命名方法及装置
CN112288990A (zh) 基于物联数据生成物联事件的方法、系统、介质及设备

Legal Events

Date Code Title Description
121 Ep: the epo has been informed by wipo that ep was designated in this application

Ref document number: 18870222

Country of ref document: EP

Kind code of ref document: A1

NENP Non-entry into the national phase

Ref country code: DE

122 Ep: pct application non-entry in european phase

Ref document number: 18870222

Country of ref document: EP

Kind code of ref document: A1