@@ -1056,31 +1056,33 @@ compartment:
1056
1056
B<Do not accept Storable documents from untrusted sources! >
1057
1057
1058
1058
Some features of Storable can lead to security vulnerabilities if you
1059
- accept Storable documents from untrusted sources. Most obviously, the
1060
- optional (off by default) CODE reference serialization feature allows
1061
- transfer of code to the deserializing process. Furthermore, any
1062
- serialized object will cause Storable to helpfully load the module
1063
- corresponding to the class of the object in the deserializing module.
1064
- For manipulated module names, this can load almost arbitrary code.
1065
- Finally, the deserialized object's destructors will be invoked when
1066
- the objects get destroyed in the deserializing process. Maliciously
1067
- crafted Storable documents may put such objects in the value of
1068
- a hash key that is overridden by another key/value pair in the
1069
- same hash, thus causing immediate destructor execution.
1070
-
1071
- In a future version of Storable, we intend to provide options to disable
1072
- loading modules for classes and to disable deserializing objects
1073
- altogether. I<Nonetheless, Storable deserializing documents from
1074
- untrusted sources is expected to have other, yet undiscovered,
1075
- security concerns such as allowing an attacker to cause the deserializer
1076
- to crash hard.>
1077
-
1078
- B<Therefore, let me repeat: Do not accept Storable documents from
1079
- untrusted sources!>
1059
+ accept Storable documents from untrusted sources with the default
1060
+ flags. Most obviously, the optional (off by default) CODE reference
1061
+ serialization feature allows transfer of code to the deserializing
1062
+ process. Furthermore, any serialized object will cause Storable to
1063
+ helpfully load the module corresponding to the class of the object in
1064
+ the deserializing module. For manipulated module names, this can load
1065
+ almost arbitrary code. Finally, the deserialized object's destructors
1066
+ will be invoked when the objects get destroyed in the deserializing
1067
+ process. Maliciously crafted Storable documents may put such objects
1068
+ in the value of a hash key that is overridden by another key/value
1069
+ pair in the same hash, thus causing immediate destructor execution.
1070
+
1071
+ To disable blessing objects while thawing/retrieving remove the flag
1072
+ BLESS_OK = 2 from C<$Storable::flags > or set the 2nd argument for
1073
+ thaw/retrieve to 0.
1074
+
1075
+ To disable tieing data while thawing/retrieving remove the flag TIE_OK
1076
+ = 4 from C<$Storable::flags > or set the 2nd argument for thaw/retrieve
1077
+ to 0.
1078
+
1079
+ With the default setting of $Storable::flags = 6, creating or destroying
1080
+ random objects, even renamed objects can be controlled by an attacker.
1081
+ See CVE-2015-1592 and its metasploit module.
1080
1082
1081
1083
If your application requires accepting data from untrusted sources, you
1082
1084
are best off with a less powerful and more-likely safe serialization format
1083
- and implementation. If your data is sufficiently simple, JSON is a good
1085
+ and implementation. If your data is sufficiently simple, JSON is the best
1084
1086
choice and offers maximum interoperability.
1085
1087
1086
1088
=head1 WARNING
@@ -1152,6 +1154,34 @@ to string or floating point. In other words values that had been generated
1152
1154
by integer operations such as logic ops and then not used in any string or
1153
1155
arithmetic context before storing.
1154
1156
1157
+ =head2 Large data on 64-bit platforms
1158
+
1159
+ Storable's current data format is incapable of representing lengths greater
1160
+ than fit into a signed 32-bit integer, or about 2 GB. In practice, this
1161
+ means that, even with the latest Perl and a 64-bit machine with plenty of
1162
+ memory, you cannot store, retrieve, or clone any of the following:
1163
+
1164
+ =over 4
1165
+
1166
+ =item *
1167
+
1168
+ A string containing 2**31 or more bytes (including as an element of an array, or
1169
+ a key or value in a hash)
1170
+
1171
+ =item *
1172
+
1173
+ An array with 2**31 or more elements
1174
+
1175
+ =item *
1176
+
1177
+ A hash with 2**31 or more keys
1178
+
1179
+ =back
1180
+
1181
+ Attempting to do so will result in unpredicatable overflow results.
1182
+
1183
+ This may be fixed in the future.
1184
+
1155
1185
=head2 64 bit data in perl 5.6.0 and 5.6.1
1156
1186
1157
1187
This section only applies to you if you have existing data written out
@@ -1226,6 +1256,8 @@ Thank you to (in chronological order):
1226
1256
1227
1257
Benjamin A. Holzman <[email protected] >
1228
1258
1259
+
1260
+
1229
1261
1230
1262
for their bug reports, suggestions and contributions.
1231
1263
0 commit comments