idnits 2.17.1 draft-bryan-ftp-hash-03.txt: Checking boilerplate required by RFC 5378 and the IETF Trust (see https://trustee.ietf.org/license-info): ---------------------------------------------------------------------------- No issues found here. Checking nits according to https://www.ietf.org/id-info/1id-guidelines.txt: ---------------------------------------------------------------------------- No issues found here. Checking nits according to https://www.ietf.org/id-info/checklist : ---------------------------------------------------------------------------- No issues found here. Miscellaneous warnings: ---------------------------------------------------------------------------- == The copyright year in the IETF Trust and authors Copyright Line does not match the current year -- The document date (May 21, 2010) is 5088 days in the past. Is this intentional? Checking references for intended status: Experimental ---------------------------------------------------------------------------- -- Obsolete informational reference (is this intentional?): RFC 3230 (Obsoleted by RFC 9530) Summary: 0 errors (**), 0 flaws (~~), 1 warning (==), 2 comments (--). Run idnits with the --verbose option for more detailed information about the items above. -------------------------------------------------------------------------------- 2 Network Working Group A. Bryan 3 Internet-Draft T. Kosse 4 Intended status: Experimental D. Stenberg 5 Expires: November 22, 2010 May 21, 2010 7 FTP Extensions for Cryptographic Hashes 8 draft-bryan-ftp-hash-03 10 Abstract 12 The File Transfer Protocol does not offer any method to verify the 13 integrity of a transferred file, nor can two files be compared 14 against each other without actually transferring them first. 15 Cryptographic hashes are a possible solution to this problem. In the 16 past, several attempts have been made to add commands to obtain 17 checksums and hashes, however none have been formally specified, 18 leading to non-interoperability and confusion. To solve these 19 issues, this document specifies a new FTP command to be used by 20 clients to request cryptographic hashes of files. 22 Status of this Memo 24 This Internet-Draft is submitted in full conformance with the 25 provisions of BCP 78 and BCP 79. 27 Internet-Drafts are working documents of the Internet Engineering 28 Task Force (IETF). Note that other groups may also distribute 29 working documents as Internet-Drafts. The list of current Internet- 30 Drafts is at http://datatracker.ietf.org/drafts/current/. 32 Internet-Drafts are draft documents valid for a maximum of six months 33 and may be updated, replaced, or obsoleted by other documents at any 34 time. It is inappropriate to use Internet-Drafts as reference 35 material or to cite them other than as "work in progress." 37 This Internet-Draft will expire on November 22, 2010. 39 Copyright Notice 41 Copyright (c) 2010 IETF Trust and the persons identified as the 42 document authors. All rights reserved. 44 This document is subject to BCP 78 and the IETF Trust's Legal 45 Provisions Relating to IETF Documents 46 (http://trustee.ietf.org/license-info) in effect on the date of 47 publication of this document. Please review these documents 48 carefully, as they describe your rights and restrictions with respect 49 to this document. Code Components extracted from this document must 50 include Simplified BSD License text as described in Section 4.e of 51 the Trust Legal Provisions and are provided without warranty as 52 described in the Simplified BSD License. 54 Table of Contents 56 1. Introduction . . . . . . . . . . . . . . . . . . . . . . . . . 3 57 1.1. Example . . . . . . . . . . . . . . . . . . . . . . . . . 3 58 2. Notational Conventions . . . . . . . . . . . . . . . . . . . . 3 59 3. The HASH Command (HASH) . . . . . . . . . . . . . . . . . . . 4 60 3.1. HASH Command Errors . . . . . . . . . . . . . . . . . . . 4 61 3.2. FEAT Command Response for HASH Command . . . . . . . . . . 5 62 3.3. Changing the HASH algorithm . . . . . . . . . . . . . . . 5 63 4. Command Usage . . . . . . . . . . . . . . . . . . . . . . . . 6 64 5. IANA Considerations . . . . . . . . . . . . . . . . . . . . . 6 65 6. Implementation Requirements . . . . . . . . . . . . . . . . . 6 66 7. Security Considerations . . . . . . . . . . . . . . . . . . . 7 67 8. References . . . . . . . . . . . . . . . . . . . . . . . . . . 7 68 8.1. Normative References . . . . . . . . . . . . . . . . . . . 7 69 8.2. Informative References . . . . . . . . . . . . . . . . . . 8 70 Appendix A. Acknowledgements and Contributors . . . . . . . . . . 8 71 Appendix B. List of Non-standard Cryptographic Hash or 72 Checksum Commands and Implementations . . . . . . . . 8 73 Appendix C. Document History . . . . . . . . . . . . . . . . . . 11 74 Authors' Addresses . . . . . . . . . . . . . . . . . . . . . . . . 11 76 1. Introduction 78 The File Transfer Protocol [RFC0959] does not offer any method to 79 verify the integrity of a transferred file, nor can two files be 80 compared against each other without actually transferring them first. 81 Cryptographic hashes are a possible solution to this problem. In the 82 past, several attempts have been made to add commands to obtain 83 checksums and hashes, however none have been formally specified, 84 leading to non-interoperability and confusion. To solve these 85 issues, this document specifies a new FTP command to be used by 86 clients to request cryptographic hashes of files. HTTP has a similar 87 feature named Instance Digests [RFC3230] which allows a client to 88 request the cryptographic hash of a file. 90 [[ Discussion of this draft should take place on 91 apps-discuss@ietf.org. ]] 93 1.1. Example 95 Example of HASH client request: 97 HASH filename.ext 99 HASH server response with Positive Completion code and the requested 100 hash using the currently selected algorithm: 102 213 80bc95fd391772fa61c91ed68567f0980bb45fd9 104 2. Notational Conventions 106 This specification describes conformance of FTP Extensions for 107 cryptographic hashes. 109 The key words "MUST", "MUST NOT", "REQUIRED", "SHALL", "SHALL NOT", 110 "SHOULD", "SHOULD NOT", "RECOMMENDED", "MAY", and "OPTIONAL" in this 111 document are to be interpreted as described in BCP 14, [RFC2119], as 112 scoped to those conformance targets. 114 In examples, the "C>" lines are commands from user-PI to server-PI, 115 and the "S>" lines are server-PI replies. 117 This document also uses notation defined in STD 9, [RFC0959]. In 118 particular, the terms "reply", "user", "file", "pathname", "FTP 119 commands", "user-PI", "server-FTP process", "server-PI", "mode", 120 "type", and "ASCII", are all used here as defined there. 122 Syntax required is defined using the Augmented BNF defined in 124 [RFC5234]. 126 3. The HASH Command (HASH) 128 A new command "HASH" is added to the FTP command set to request the 129 cryptographic hash of a file from a server-FTP process. 131 The syntax for the HASH command is: 133 hash = "HASH" SP 135 As with all FTP commands, the "HASH" command word is case 136 independent, and MAY be specified in any character case desired. 138 The HASH command keyword MUST be followed by a single space (ASCII 139 32) followed by the pathname. 141 The pathname argument should reference the same file as other file 142 based commands such as STOR or RETR which the same argument would 143 reference. 145 The text returned in response to the HASH command MUST be: 147 hash-response = "213" SP 1*HEXDIGIT CRLF 149 All hash values MUST be encoded in lowercase hexadecimal format. 151 The HASH command is meant to be used for files transmitted in Image 152 type mode (TYPE I) and Stream transfer mode (MODE S). The returned 153 hash MUST be calculated over the raw octet data of the file 154 irrespective of the selected data type, transfer mode or any other 155 state affecting the transfer. In other words, if a client were to 156 download a full file using TYPE I and MODE S and were to calculate 157 the hash on the received octet data, it would be identical to the 158 hash returned by HASH. 160 3.1. HASH Command Errors 162 The standard negative error codes 500 and 501 are used to handle 163 errors involving the HASH command (e.g., syntax errors). Response 164 code 501 is used if an unknown or unsupported algorithm has been 165 requested. Response code 550 is used if the file can not be found. 166 Response code 552 is used if the user is not allowed to use the HASH 167 command. Response code 450 is used to indicate the server is busy, 168 e.g. already hashing other files yet inviting the client to retry in 169 future. 171 3.2. FEAT Command Response for HASH Command 173 A server-FTP process that supports the HASH command MUST include, in 174 the response to the FEAT command [RFC2389], a feature line indicating 175 that the HASH command is supported, along with a list of all 176 supported hash algorithms in a semicolon separated list. The hash 177 algorithm that is currently selected MUST be marked with an asterisk. 178 This command word is case insensitive, but it SHOULD be transmitted 179 in upper case only. That is, the response SHOULD be: 181 C> FEAT 182 S> 211-Extensions supported: 183 S> ... 184 S> HASH SHA-1*;MD5 185 S> ... 186 S> 211 END 188 The ellipses indicate place holders where other features MAY be 189 listed, but this is OPTIONAL. The single space indentation of each 190 feature line is REQUIRED by [RFC2389]. 192 The IANA registry named "Hash Function Textual Names" defines values 193 for hash types. Hash names should be presented in uppercase, but 194 comparisons should be case-insensitive, e.g. MD5, md5, Md5 are all 195 the same. 197 hash-feat = SP "HASH" SP hashlist CRLF 198 hashlist = 1*( hashname ["*"] ";" ) 199 hashname = 1*( hchar ) 200 hchar = ALPHA / DIGIT / "-" / "_" / "/" / "." / "," 202 3.3. Changing the HASH algorithm 204 To query the current hash algorithm and to change it, the OPTS 205 command as defined in [RFC2389] is used with HASH as the first 206 argument. If no second argument is passed, OPTS HASH simply returns 207 the currently selected hash algorithm. To change the algorithm, a 208 valid hashtype MUST be given as second argument. If the command is 209 successful, all future calls to HASH until the next successful OPTS 210 HASH command or until the session is reinitialized (REIN) will use 211 the selected hash algorithm. 213 C> OPTS HASH 214 S> 200 SHA-1 215 C> OPTS HASH SHA-512 216 S> 200 SHA-512 217 C> OPTS HASH CRC-37 218 S> 501 Unknown algorithm, current selection not changed 220 hashopts-cmd = "OPTS HASH" [ SP hashtype ] CRLF 221 hashopts-response = "200" SP hashtype CRLF 223 4. Command Usage 225 Client requests the cryptographic hash of a file with HASH command. 226 Server replies with cryptographic hash of file. Client downloads 227 file. Client hashes the downloaded file and compares its hash to the 228 hash obtained from the server. This command could also be used to 229 verify that an uploaded file is an exact copy. 231 5. IANA Considerations 233 This new command is added to the "FTP Commands and Extensions" 234 registry created by [RFC5797]. 236 Command Name: HASH 238 Description: Cryptographic Hash of a file 240 FEAT String: HASH 242 Command Type: Service execution 244 Conformance Requirements: Optional 246 Reference: This specification 248 6. Implementation Requirements 250 All conforming implementations MUST at least support the SHA-1 251 algorithm. Implementations SHOULD NOT make any algorithm the default 252 that is known to be weaker than SHA-1. Support for any additional 253 algorithms is OPTIONAL. 255 7. Security Considerations 257 Calculating a file's hash is a CPU intensive operation and can easily 258 consume the available disk I/O resources. If the HASH command isn't 259 implemented carefully, a server could be vulnerable to a denial of 260 service attack. On an affected server a malicious user could, for 261 example, continuously send HASH commands over multiple connections 262 and thus consume most of the FTP server's CPU and disk I/O resources, 263 leaving little room for other operations. To mitigate this risk, a 264 server SHOULD cache the calculated hashes so that the hash of a file 265 is only calculated once even if multiple hash requests are sent for 266 that file. 268 The performance of commonly used hard disk drives is adversely 269 affected by the amount of time the device needs to reposition its 270 read-and-write heads. A server SHOULD therefore avoid hashing 271 multiple files at the same time which are located on the same 272 physical media and SHOULD instead hash them sequentially. The FTP 273 server's right to refuse to calculate the hash is of course important 274 to help against DOS risks. A possible solution is to use the 450 275 reply code of HASH to indicate that the server is already busy with 276 another HASH operation. 278 In addition, the HASH command can be used to draw conclusions about 279 the contents of a file. If the hash of a file on some server matches 280 the hash of some known, local file, both files are likely identical. 281 To prevent this scenario it suffices to limit use of the HASH command 282 to users who would already be able to download the file. 284 Currently, some of the hash types defined in the IANA registry named 285 "Hash Function Textual Names" are considered insecure. These include 286 the whole Message Digest family of algorithms that are not suitable 287 for cryptographically strong verification. Malicious people could 288 provide files that appear to be identical to another file because of 289 a collision, i.e., the weak cryptographic hashes of the intended file 290 and a substituted malicious file could match. 292 8. References 294 8.1. Normative References 296 [RFC0959] Postel, J. and J. Reynolds, "File Transfer Protocol", 297 STD 9, RFC 0959, October 1985. 299 [RFC2119] Bradner, S., "Key words for use in RFCs to Indicate 300 Requirement Levels", BCP 14, RFC 2119, March 1997. 302 [RFC2389] Hethmon, P. and R. Elz, "Feature negotiation mechanism for 303 the File Transfer Protocol", RFC 2389, August 1998. 305 [RFC5234] Crocker, D. and P. Overell, "Augmented BNF for Syntax 306 Specifications: ABNF", STD 68, RFC 5234, January 2008. 308 8.2. Informative References 310 [RFC3230] Mogul, J. and A. Van Hoff, "Instance Digests in HTTP", 311 RFC 3230, January 2002. 313 [RFC5797] Klensin, J. and A. Hoenes, "FTP Command and Extension 314 Registry", RFC 5797, March 2010. 316 [draft-twine-ftpmd5] 317 Twine, J., "The MD5 and MMD5 FTP Command Extensions", 318 draft-twine-ftpmd5-00 (work in progress), May 2002. 320 Appendix A. Acknowledgements and Contributors 322 Thanks to John C. Klensin, Alfred Hoenes, James Twine, Robert 323 McMurray, and Mathias Berchtold. 325 Appendix B. List of Non-standard Cryptographic Hash or Checksum 326 Commands and Implementations 328 [[ to be removed by the RFC editor before publication as an RFC. ]] 330 A number of similar checksum or hash commands exist, but are not 331 formally specified, leading to non-interoperability and confusion. 332 The commands, any specifications, and relevant details: 334 o CKSM: GridFTP v2 Protocol Description 335 http://www.ogf.org/documents/GFD.47.pdf Usage: OPTS CKSM 336 CRLF. Supports ADLER32, MD5, CRC32. 337 o MD5/MMD5: Expired Internet Draft [draft-twine-ftpmd5] from 2002. 338 Usage: MD5 Algorithm specific command. Response codes: 339 251 positive completion, 500 Command Not Recognized, 502 Command 340 Not Implemented, 504 Command Not Implemented for the Specified 341 Argument. 342 o SITE CHECKSUM: Usage: SITE check_login SP CHECKSUM SP pathname 343 CRLF. Supports CRC32 and MD5. 344 o SITE SHOHASH: Usage: site shohash [filename]. Supports MD5. 345 Response codes: 200 positive completion. 347 o XCRC: By GlobalSCAPE in 2001. http://help.globalscape.com/help/ 348 secureserver2/File_Integrity_Checking.htm Usage: XCRC 349 SP EP. SP is starting point and EP is ending point in bytes and 350 are optional parameters. Algorithm specific command. Response 351 codes: 250 positive completion, 450 Requested file action not 352 taken. (File is busy), 550 Requested action not taken. (File not 353 found, no read permission, SP or EP not correct). 354 o XMD5: XMD5 SP EP. Similar to XCRC. Algorithm specific 355 command. 356 o XSHA, XSHA1, XSHA256, XSHA512: Usage similar to XCRC, although 357 SP/EP usage unknown. Algorithm specific commands. 359 An incomplete list of FTP clients and servers that have implemented 360 these commands: 362 o Akamai NetStorage (supports SITE CHKHSH/SITE SHOHASH) p17-18 363 http://pigdogslow.dyndns.org/NetStorage_UserGuide.pdf 364 o Apache Ftp Server (supports MD5/MMD5 from draft-twine-ftpmd5) 365 http://cwiki.apache.org/FTPSERVER/documentation.html 366 o Backup4all Pro (supports XCRC) 367 o Backup to FTP (supports XCRC) 368 o BlackMoon FTP Server (supports XCRC) 369 http://www.blackmoonftpserver.com/portal/readmore/features.html 370 o C.P.A. Secure (supports XCRC) 371 http://www.cpasecure.com/CPASecureVsSecureFTP.html 372 o Cerberus FTP server (supports XCRC, XMD5, XSHA1, XSHA256, XSHA512) 373 http://www.softpedia.com/progChangelog/ 374 Cerberus-FTP-Server-Changelog-1904.html 375 o Core FTP Pro (supports XCRC) 376 o Cross FTP Server (supports MD5/MMD5) 377 o FileCOPA FTP Server (supports XCRC, XMD5, XSHA1) 378 http://www.filecopa-ftpserver.com/features.html 379 o File Watchdogs FTP Server (supports XCRC, XMD5, XSHA1, XSHA256, 380 XSHA512) 381 http://www.filewatchdogs.com/ftpsitehosting/help/15559.htm 382 o FireFTP (supports XMD5, XSHA1) 383 http://fireftp.mozdev.org/features.html 384 o FTP Daemon (supports SITE CHECKMETHOD/SITE CHECKSUM) 385 http://www.pro-bono-publico.de/projects/ftpd.html 386 o FTP Voyager (supports XCRC) http://www.ftpvoyager.com/XCRC.asp 387 o Gene6 FTP Server 388 http://www.g6ftpserver.com/en/information#features 389 o GlobalSCAPE's Secure FTP Server / EFT Server / CuteFTP clients 390 (supports XCRC) 391 o Globus FTP client / Globus Toolkit(supports CKSM) http:// 392 www.globus.org/toolkit/releasenotes/3.2.0/gridftp_notes.html 394 o GoldenGate FTP (Ftp Full Java Server) (supports XCRC, XMD5, XSHA1) 395 o IceWarp FTP Server http://www.icewarp.com/products/ftp_server/ 396 o ICS FTP client (supports XCRC, XMD5) 397 http://www.magsys.co.uk/delphi/magics.asp 398 o ioFTPD (supports XCRC) 399 o JAFS (supports XCRC and MD5) 400 http://www.sbbi.net/site/jafs/features.html 401 o Kellerman FTP (supports XCRC) 402 http://sharptoolbox.com/tools/kellerman-ftp 403 o Limagito FTP server (supports XCRC, XMD5, XSHA1) 404 http://www.limagito.com/file-mover-features.html 405 o MOVEit DMZ (supports XSHA1) 406 o Nofeel FTP server (supports XCRC, XMD5, XSHA1) 407 http://www.nftpserver.com/history.php 408 o Null FTP (supports XCRC, XMD5, XSHA) 409 http://www.sharewareconnection.com/null-ftp-client-pro.htm 410 o Orenosv FTP Client (supports XCRC, XMD5) 411 http://www.orenosv.com/orenosv/ftpcli_en.html 412 o ProFTPD module mod_digest (supports XCRC, XMD5, XSHA1, SHA256) 413 http://www.smartftp.com/oss/proftpd/mod_digest.html 414 o PSFTPd Secure FTP Server (supports XCRC, XMD5, XSHA) 415 http://www.psftp.de/psftpd_fo.php 416 o Quick 'n Easy FTP Server (supports XCRC) http:// 417 www.pablosoftwaresolutions.com/html/ 418 quick__n_easy_ftp_server_pro.html 419 o RaidenFTPD32 FTP server (supports XCRC, XMD5) 420 o Robo-FTP Server (supports XCRC, XMD5, XSHA1) 421 http://kb.robo-ftp.com/change_log/show/61 422 o SyncBackPro and SyncBackSE (supports XCRC) 423 http://www.2brightsparks.com/syncback/sbpro-changes.html 424 o Secure FTP Factory (supports XCRC) 425 o Serv-U FTP Server (supports XCRC) http://www.serv-u.com/help/ 426 serv_u_help/additional_ftp_commands_supported_by_serv_u.htm 427 o SmartFTP client (supports XCRC, XMD5, XSHA, CKSM) 428 http://www.smartftp.com/features/ 429 o Starksoft Ftp Component for .NET / Mono (supports XCRC, XMD5, 430 XSHA1) http://www.starksoft.com/prod_ftp.html 431 o Titan FTP Server (supports XCRC) 432 o Turbo FTP (supports XCRC) 433 o WISE-FTP (supports XCRC) http://www.wise-ftp.com/news/ 434 o WS_FTP client / server (supports XSHA1, server also XMD5, XSHA1, 435 XSHA256, XSHA512) http://ipswitchft.custhelp.com/app/answers/ 436 detail/a_id/671/kw/xmd5/r_id/166/sno/1 437 o wuftpd (supports SITE CHECKMETHOD/SITE CHECKSUM) 438 o wzdFTPd (supports XCRC, XMD5) 439 http://www.wzdftpd.net/wiki/index.php/Commands 441 o Zalman FTP Client (supports XCRC) 442 http://www.zalmansoftware.com/download.html 443 o zFTPServer 445 Appendix C. Document History 447 [[ to be removed by the RFC editor before publication as an RFC. ]] 449 Known issues concerning this draft: 450 o Partial file hashes, similar to the Content-MD5 HTTP Header. 451 o Underspecification of the representation of the file that shall 452 undergo the hash calculation. 454 -03 : April , 2010. 455 o List of non-standard checksum and hash commands and their 456 implementations. 458 -02 : April 16, 2010. 459 o Error codes section. 461 -01 : April 7, 2010. 462 o Changing HASH algorithm with OPTS. 463 o Reference RFC 5797 and add IANA Considerations section. 464 o Informative Reference to expired Internet Draft 465 (draft-twine-ftpmd5) which attempted to address this issue (it 466 only supported one hash, MD5). 468 -00 : October 19, 2009. 469 o Initial draft. 471 Authors' Addresses 473 Anthony Bryan 474 Pompano Beach, FL 475 USA 477 Email: anthonybryan@gmail.com 478 URI: http://www.metalinker.org 480 Tim Kosse 482 Email: tim.kosse@filezilla-project.org 483 URI: http://filezilla-project.org/ 484 Daniel Stenberg 486 Email: daniel@haxx.se 487 URI: http://www.haxx.se/