1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
5 // Client side phishing and malware detection request and response
6 // protocol buffers. Those protocol messages should be kept in sync
7 // with the server implementation.
9 // If you want to change this protocol definition or you have questions
10 // regarding its format please contact chrome-anti-phishing@googlegroups.com.
14 option optimize_for = LITE_RUNTIME;
16 package safe_browsing;
18 // Protocol buffer describing the Chrome user population of the user reporting
20 message ChromeUserPopulation {
22 UNKNOWN_USER_POPULATION = 0;
24 EXTENDED_REPORTING = 2;
26 optional UserPopulation user_population = 1;
30 message ClientPhishingRequest {
31 // URL that the client visited. The CGI parameters are stripped by the
33 optional string url = 1;
35 // A 5-byte SHA-256 hash prefix of the URL. Before hashing the URL is
36 // canonicalized, converted to a suffix-prefix expression and broadened
37 // (www prefix is removed and everything past the last '/' is stripped).
39 // Marked OBSOLETE because the URL is sent for all users, making the hash
40 // prefix unnecessary.
41 optional bytes OBSOLETE_hash_prefix = 10;
43 // Score that was computed on the client. Value is between 0.0 and 1.0.
44 // The larger the value the more likely the url is phishing.
45 required float client_score = 2;
47 // Note: we're skipping tag 3 because it was previously used.
49 // Is true if the features for this URL were classified as phishing.
50 // Currently, this will always be true for all client-phishing requests
51 // that are sent to the server.
52 optional bool is_phishing = 4;
55 // Feature name. E.g., 'PageHasForms'.
56 required string name = 1;
58 // Feature value is always in the range [0.0, 1.0]. Boolean features
60 required double value = 2;
63 // List of features that were extracted. Those are the features that were
64 // sent to the scorer and which resulted in client_score being computed.
65 repeated Feature feature_map = 5;
67 // The version number of the model that was used to compute the client-score.
68 // Copied from ClientSideModel.version().
69 optional int32 model_version = 6;
71 // Field 7 is only used on the server.
73 // List of features that are extracted in the client but are not used in the
74 // machine learning model.
75 repeated Feature non_model_feature_map = 8;
77 // The referrer URL. This field might not be set, for example, in the case
78 // where the referrer uses HTTPs.
79 // OBSOLETE: Use feature 'Referrer=<referrer>' instead.
80 optional string OBSOLETE_referrer_url = 9;
82 // Field 11 is only used on the server.
84 // List of shingle hashes we extracted.
85 repeated uint32 shingle_hashes = 12 [packed = true];
87 // The model filename (basename) that was used by the client.
88 optional string model_filename = 13;
90 // Population that the reporting user is part of.
91 optional ChromeUserPopulation population = 14;
94 message ClientPhishingResponse {
95 required bool phishy = 1;
97 // A list of SafeBrowsing host-suffix / path-prefix expressions that
98 // are whitelisted. The client must match the current top-level URL
99 // against these whitelisted expressions and only apply a positive
100 // phishing verdict above if the URL does not match any expression
101 // on this whitelist. The client must not cache these whitelisted
102 // expressions. This whitelist will be empty for the vast majority
103 // of the responses but might contain up to 100 entries in emergency
106 // Marked OBSOLETE because the URL is sent for all users, so the server
107 // can do whitelist matching.
108 repeated string OBSOLETE_whitelist_expression = 2;
111 message ClientMalwareRequest {
112 // URL that the client visited. The CGI parameters are stripped by the
114 required string url = 1;
116 // Field 2 is deleted and no longer in use.
118 // Field 3 is only used on the server.
120 // The referrer URL. This field might not be set, for example, in the case
121 // where the referrer uses HTTPS.
122 optional string referrer_url = 4;
124 // Field 5 and 6 are only used on the server.
127 required string ip = 1;
128 required string url = 2;
129 optional string method = 3;
130 optional string referrer = 4;
131 // Resource type, the int value is a direct cast from the Type enum
132 // of ResourceType class defined in //src/webkit/commom/resource_type.h
133 optional int32 resource_type = 5;
136 // List of resource urls that match the malware IP list.
137 repeated UrlInfo bad_ip_url_info = 7;
139 // Population that the reporting user is part of.
140 optional ChromeUserPopulation population = 9;
143 message ClientMalwareResponse {
144 required bool blacklist = 1;
145 // The confirmed blacklisted bad IP and its url, which will be shown in
146 // malware warning, if the blacklist verdict is true.
147 // This IP string could be either in IPv4 or IPv6 format, which is the same
148 // as the ones client sent to server.
149 optional string bad_ip = 2;
150 optional string bad_url = 3;
153 message ClientDownloadRequest {
154 // The final URL of the download (after all redirects).
155 required string url = 1;
157 // This message contains various binary digests of the download payload.
159 optional bytes sha256 = 1;
160 optional bytes sha1 = 2;
161 optional bytes md5 = 3;
163 required Digests digests = 2;
165 // This is the length in bytes of the download payload.
166 required int64 length = 3;
168 // Type of the resources stored below.
170 // The final URL of the download payload. The resource URL should
171 // correspond to the URL field above.
173 // A redirect URL that was fetched before hitting the final DOWNLOAD_URL.
174 DOWNLOAD_REDIRECT = 1;
175 // The final top-level URL of the tab that triggered the download.
177 // A redirect URL thas was fetched before hitting the final TAB_URL.
182 required string url = 1;
183 required ResourceType type = 2;
184 optional bytes remote_ip = 3;
185 // This will only be set if the referrer is available and if the
186 // resource type is either TAB_URL or DOWNLOAD_URL.
187 optional string referrer = 4;
189 // TODO(noelutz): add the transition type?
192 // This repeated field will store all the redirects as well as the
193 // final URLs for the top-level tab URL (i.e., the URL that
194 // triggered the download) as well as for the download URL itself.
195 repeated Resource resources = 4;
197 // A trust chain of certificates. Each chain begins with the signing
198 // certificate of the binary, and ends with a self-signed certificate,
199 // typically from a trusted root CA. This structure is analogous to
200 // CERT_CHAIN_CONTEXT on Windows.
201 message CertificateChain {
202 // A single link in the chain.
204 // DER-encoded X.509 representation of the certificate.
205 optional bytes certificate = 1;
206 // Fields 2 - 7 are only used on the server.
208 repeated Element element = 1;
211 message SignatureInfo {
212 // All certificate chains for each of the binary's signers. Multiple chains
213 // may be present if the binary or any certificate has multiple signers.
214 // Absence of certificate chains does not imply that the binary is not
215 // signed (in that case, SignedData blobs extracted from the binary may be
216 // preset), but does mean that trust has not been verified.
217 repeated CertificateChain certificate_chain = 1;
219 // True if the signature was trusted on the client.
220 optional bool trusted = 2;
222 // PKCS#7 SignedData blobs extracted from a portable executable image's
223 // attribute certificate table. The presence of these does not imply that
224 // the signatures were deemed trusted by the client.
225 repeated bytes signed_data = 3;
228 // This field will only be set if the binary is signed.
229 optional SignatureInfo signature = 5;
231 // True if the download was user initiated.
232 optional bool user_initiated = 6;
234 // Fields 7 and 8 are only used on the server.
236 // Name of the file where the download would be stored if the
237 // download completes. E.g., "bla.exe".
238 optional string file_basename = 9;
240 // Starting with Chrome M19 we're also sending back pings for Chrome
241 // extensions that get downloaded by users.
243 WIN_EXECUTABLE = 0; // Currently all .exe, .cab and .msi files.
244 CHROME_EXTENSION = 1; // .crx files.
245 ANDROID_APK = 2; // .apk files.
246 // .zip files containing one of the other executable types.
247 ZIPPED_EXECUTABLE = 3;
248 MAC_EXECUTABLE = 4; // .dmg, .pkg, etc.
250 optional DownloadType download_type = 10 [default = WIN_EXECUTABLE];
252 // Locale of the device, eg en, en_US.
253 optional string locale = 11;
255 message PEImageHeaders {
257 optional bytes dos_header = 1;
258 // IMAGE_FILE_HEADER.
259 optional bytes file_header = 2;
260 // IMAGE_OPTIONAL_HEADER32. Present only for 32-bit PE images.
261 optional bytes optional_headers32 = 3;
262 // IMAGE_OPTIONAL_HEADER64. Present only for 64-bit PE images.
263 optional bytes optional_headers64 = 4;
264 // IMAGE_SECTION_HEADER.
265 repeated bytes section_header = 5;
266 // Contents of the .edata section.
267 optional bytes export_section_data = 6;
270 // IMAGE_DEBUG_DIRECTORY.
271 optional bytes directory_entry = 1;
272 optional bytes raw_data = 2;
275 repeated DebugData debug_data = 7;
278 message MachOHeaders {
279 // The mach_header or mach_header_64 struct.
280 required bytes mach_header = 1;
282 message LoadCommand {
283 // |command_id| is the first uint32 of |command| as well, but is
284 // extracted for easier processing.
285 required uint32 command_id = 1;
286 // The entire data stream of the load command.
287 required bytes command = 2;
290 // All the load commands of the Mach-O file.
291 repeated LoadCommand load_commands = 2;
294 message ImageHeaders {
295 // Windows Portable Executable image headers.
296 optional PEImageHeaders pe_headers = 1;
298 // OS X Mach-O image headers.
299 optional MachOHeaders mach_o_headers = 2;
302 // Fields 12-17 are reserved for server-side use and are never sent by the
305 optional ImageHeaders image_headers = 18;
307 // Fields 19-21 are reserved for server-side use and are never sent by the
310 // A binary contained in an archive (e.g., a .zip archive).
311 message ArchivedBinary {
312 optional string file_basename = 1;
313 optional DownloadType download_type = 2;
314 optional Digests digests = 3;
315 optional int64 length = 4;
316 optional SignatureInfo signature = 5;
317 optional ImageHeaders image_headers = 6;
320 repeated ArchivedBinary archived_binary = 22;
322 // Population that the reporting user is part of.
323 optional ChromeUserPopulation population = 24;
326 message ClientDownloadResponse {
328 // Download is considered safe.
330 // Download is considered dangerous. Chrome should show a warning to the
333 // Download is unknown. Chrome should display a less severe warning.
335 // The download is potentially unwanted.
336 POTENTIALLY_UNWANTED = 3;
337 // The download is from a dangerous host.
340 required Verdict verdict = 1;
343 // A human-readable string describing the nature of the warning.
344 // Only if verdict != SAFE. Localized based on request.locale.
345 optional string description = 1;
347 // A URL to get more information about this warning, if available.
348 optional string url = 2;
350 optional MoreInfo more_info = 2;
352 // An arbitrary token that should be sent along for further server requests.
353 optional bytes token = 3;
356 // The following protocol buffer holds the feedback report gathered
357 // from the user regarding the download.
358 message ClientDownloadReport {
359 // The information of user who provided the feedback.
360 // This is going to be useful for handling appeals.
361 message UserInformation {
362 optional string email = 1;
371 // The type of feedback for this report.
372 optional Reason reason = 1;
374 // The original download ping
375 optional ClientDownloadRequest download_request = 2;
377 // Stores the information of the user who provided the feedback.
378 optional UserInformation user_information = 3;
380 // Unstructed comments provided by the user.
381 optional bytes comment = 4;
383 // The original download response sent from the verdict server.
384 optional ClientDownloadResponse download_response = 5;
387 // This is used to send back upload status to the client after upload completion
388 message ClientUploadResponse {
390 // The upload was successful and a complete response can be expected
393 // The upload was unsuccessful and the response is incomplete.
397 // Holds the upload status
398 optional UploadStatus status = 1;
400 // Holds the permalink where the results of scanning the binary are available
401 optional string permalink = 2;
404 message ClientIncidentReport {
405 message IncidentData {
406 message TrackedPreferenceIncident {
410 WEAK_LEGACY_OBSOLETE = 2;
412 UNTRUSTED_UNKNOWN_VALUE = 4;
415 optional string path = 1;
416 optional string atomic_value = 2;
417 repeated string split_key = 3;
418 optional ValueState value_state = 4;
420 message BinaryIntegrityIncident {
421 optional string file_basename = 1;
422 optional ClientDownloadRequest.SignatureInfo signature = 2;
424 message BlacklistLoadIncident {
425 optional string path = 1;
426 optional ClientDownloadRequest.Digests digest = 2;
427 optional string version = 3;
428 optional bool blacklist_initialized = 4;
429 optional ClientDownloadRequest.SignatureInfo signature = 5;
430 optional ClientDownloadRequest.ImageHeaders image_headers = 6;
432 message VariationsSeedSignatureIncident {
433 optional string variations_seed_signature = 1;
435 message ResourceRequestIncident {
441 optional bytes digest = 1;
442 optional string origin = 2;
443 optional Type type = 3 [default = UNKNOWN];
445 optional int64 incident_time_msec = 1;
446 optional TrackedPreferenceIncident tracked_preference = 2;
447 optional BinaryIntegrityIncident binary_integrity = 3;
448 optional BlacklistLoadIncident blacklist_load = 4;
449 // Note: skip tag 5 because it was previously used.
450 optional VariationsSeedSignatureIncident variations_seed_signature = 6;
451 optional ResourceRequestIncident resource_request = 7;
454 repeated IncidentData incident = 1;
456 message DownloadDetails {
457 optional bytes token = 1;
458 optional ClientDownloadRequest download = 2;
459 optional int64 download_time_msec = 3;
460 optional int64 open_time_msec = 4;
463 optional DownloadDetails download = 2;
465 message EnvironmentData {
467 optional string os_name = 1;
468 optional string os_version = 2;
472 optional string cpu_architecture = 1;
473 optional string cpu_vendor = 2;
474 optional uint32 cpuid = 3;
476 optional Machine machine = 2;
478 optional string version = 1;
479 repeated string OBSOLETE_dlls = 2;
481 optional string function = 1;
482 optional string target_dll = 2;
484 repeated Patch patches = 3;
485 message NetworkProvider {}
486 repeated NetworkProvider network_providers = 4;
494 optional Channel chrome_update_channel = 5;
495 optional int64 uptime_msec = 6;
496 optional bool metrics_consent = 7;
497 optional bool extended_consent = 8;
503 optional string path = 1;
504 optional uint64 base_address = 2;
505 optional uint32 length = 3;
506 repeated Feature feature = 4;
507 optional ClientDownloadRequest.ImageHeaders image_headers = 5;
509 repeated Dll dll = 9;
510 repeated string blacklisted_dll = 10;
511 message ModuleState {
514 MODULE_STATE_UNKNOWN = 1;
515 MODULE_STATE_UNMODIFIED = 2;
516 MODULE_STATE_MODIFIED = 3;
518 optional string name = 1;
519 optional ModifiedState modified_state = 2;
520 repeated string OBSOLETE_modified_export = 3;
522 message Modification {
523 optional uint32 file_offset = 1;
524 optional int32 byte_count = 2;
525 optional bytes modified_bytes = 3;
526 optional string export_name = 4;
528 repeated Modification modification = 4;
530 repeated ModuleState module_state = 11;
532 optional Process process = 3;
535 optional EnvironmentData environment = 3;
537 // Population that the reporting user is part of.
538 optional ChromeUserPopulation population = 7;
541 message ClientIncidentResponse {
542 optional bytes token = 1;
543 optional bool download_requested = 2;
545 message EnvironmentRequest { optional int32 dll_index = 1; }
547 repeated EnvironmentRequest environment_requests = 3;
550 message DownloadMetadata {
551 optional uint32 download_id = 1;
553 optional ClientIncidentReport.DownloadDetails download = 2;